Here is some notes about Docker I learned today.
This problem happens when I create a Dockerfile based on the base “Ubuntu” image and want to run “apt-get update && apt-get install -y something” on it. When executing the “apt-get update” step of during Docker building process, it always reports error like “Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease" and so on.
Google and find posts like here and here. But the problem is still there. The final solution comes from here. The key is that, besides enabling the DNS arguments of Docker, I need to use the specific DNS server of my environment instead of the default Google DNS server. Here is the steps.
# 1. Run the following command to get the DNS server.
Run the following command:
docker exec -it <container-id> bash
For an exampleRun the following commands:
# In this example, "184.108.40.206" is the argument of "xio-sim-docker.sh".
# docker cp <containerId>:/file/path/within/container /host/path/target