[Experience] using Docker as a compilation library environment summary

Source: Internet
Author: User
Tags gmp docker ps docker run

Upgrade gcc4.8.4, encounter some of the pits summarized here.

The first thing to do is to check which mirrors Docker has:
Docker images
We found the image we wanted.

First, remove the previously restricted Docker container:

Docker RM $ (Docker ps-a-Q)

Then delete some images without tag.

Docker RMI $ (Docker images | grep "^<none>" | awk "{print $}")

Now it's time to do something:

Prepare the Docker File in the directory:

From Centos:6

And then execute

Docker build-t "Docker_gcc_4_8_4"

This step generates a basic Docker environment

Then log on to the appropriate machine and perform the following:

Docker run-it-v/data/tmp/:/tmp/--name BUILD_GCC 127.0.0.1:8000/docker_gcc_4_8_4/bin/bash

So we get into the Docker environment.

Here's how to perform the upgrade:
Back up the original GCC first

#!/bin/bash
mkdir-p/data/gcc-bak
bak_list= "/usr/bin/gcc/usr/lib64/libgomp.so.1.0.0/usr/share/info/ Libgomp.info.gz/usr/share/info/dir/usr/bin/c++/usr/bin/g++/usr/share/man/man1/g++.1.gz/usr/bin/cpp/usr/share/ info/cpp.info.gz/usr/share/info/cppinternals.info.gz/usr/share/locale//usr/share/man/man1/cpp.1.gz/usr/lib64/ Libstdc++.so.6 "for
file in $bak _list
does
        cp-r $file/data/gcc-bak/
Done

Then, create the following file in the/etc/ld.so.conf.d/directory

Cat gmp-mpfr-mpc.conf
/usr/local/mpfr-2.4.2/lib/
/usr/local/mpc-0.8.1/lib/
/usr/local/gmp-4.3.2/lib /

Then extract the/tmp/lib.tar.gz into the/usr/local directory and perform the Ldconfig update cache.
Try yum to install rpm

Yum Install gcc-4.8.4-1.x86_64.rpm

Find that too much reliance is missing

Finally, the dependency forcing update is ignored:

/bin/rpm-ivh/data/gcc-4.8.4-1.x86_64.rpm--force--nodeps

Write a simple program, verify that there is no problem, the upgrade is complete.

#include <stdio.h>

int main ()
{
  printf ("Hello world\n");
  return 0;
}

There was also a problem with no route to host when using Docker as a push to the Docker private warehouse.

$ docker Commit
$ docker push $REGISTRY _ip:5000/docker_gcc_4_8_4:latest

Error response from Daemon:invalid Registry endpoint "Http://192.0.1.10:5000/v0/". HTTPS attempt:unable to ping registry endpoint https://192.0.1.10:5000/v0/
V2 ping attempt failed with Error:get HTT ps://192.0.1.10:5000/v2/: Dial TCP 192.0.1.10:5000:no route to host
 v1 ping attempt failed with Error:get HTTPS://19 2.0.1.10:5000/v1/_ping:dial TCP 192.0.1.10:5000:no route to host.  HTTP attempt:unable to ping Registry ENDP
v2 Ping attempt failed with Error:get http://192.0.1.10:5000/v2/: Dial TCP 192.0.1.10:5000:no route to host
 v1 ping attempt failed with error:get http://192.0.1.10:5000/v1/_ping:dial TCP 1 92.0.1.10:5000:no Route to host
5000 port is the port of the Docker private cloud by following this command to start the machine Docker repository host's 5000 port: sudo docker run-d-P 5,000:5,000 -v/opt/data/registry:/tmp/registry Registry 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.