docker mirror source modification

Docker mirror source modification

Use docker toolbox to install Windows Docker

Use docker run command to run an application in the container.

Hello world output

runoob@runoob:~$ docker run ubuntu:15.10 /bin/echo "Hello world"
Hello world

But there is a problem, unable to find image 'ubuntu: 15.10' locally

The reason: docker default source for foreign official source, cause this is not mirrored to a local carrier, can be changed to the domestic.

solution:

Option One:

Add or modify steps of /etc/docker/daemon.json(linux)

$ vi /etc/docker/daemon.json

{"registry-mirrors": ["http://hub-mirror.c.163.com"]}

systemctl restart docker.service

The case will not be modified

You want to open administrator privileges, but can not sudo. So temporarily abandoned this approach

Option II:

(For creating a new situation of docker)
docker-machine create --engine-registry-mirror=国内镜像地址 -d virtualbox default//default是要创建的docker实例的名字

docker-machine env default

eval $("G:\docker\Docker Toolbox\docker-machine.exe" env default)

Before and after these three codes in the order, docker info no change. So temporarily abandoned.

third solution:

Open a new toolbox;

Input docker-machine ssh default//切换到某个docker实例,default就是要切换的实例的名字;

Then execution sudo vi /var/lib/boot2docker/profile

In --label provider = virtualbox add the next line --registry-mirror http://hub-mirror.c.163.com, save the file and exit;

Execute the command sudo /etc/init.d/docker restart;

Docker then docker info display system information, mirroring address is changing for the better.

Try again output hello world, became became become!

Guess you like

Origin www.cnblogs.com/huang0926huang/p/12159165.html