docker pull learn/tutorial failed to pull images

After installing docker, execute docker pull learn/tutorial to find the mirror pull

[root@bogon ~]# docker pull learn/tutorial

Using default tag: latest

Trying to pull repository docker.io/learn/tutorial ...

latest: Pulling from docker.io/learn/tutorial

271134aeb542: Pulling fs layer

refer to this address

https://ieevee.com/tech/2016/09/28/docker-mirror.html

https://github.com/silenceshell/docker_mirror

docker_mirror

Find the fastest docker image source in China, supporting CentOS/Ubuntu.

Written in Python, requires root privileges, supports ubuntu and centos7, other operating systems need to be supplemented.

The usage method is very simple, download  the docker_mirror.py  file to the local, execute the following command, the script will automatically try to download the latest docker image of centos from official, aliyun, netease, ustc, and calculate the usage time; The image sets the docker configuration and restarts the docker process.

python ./docker_mirror.py

After the script is executed, the fastest docker image can be used directly.

Follow the above book, and then re-pull the mirror

docker pull learn/tutorial
Using default tag: latest
Trying to pull repository docker.io/learn/tutorial ...
latest: Pulling from docker.io/learn/tutorial
271134aeb542: Pull complete
Digest: sha256:2933b82e7c2a72ad8ea89d58af5d1472e35dacd5b7233577483f58ff8f9338bd
[root@bogon ~]#

 

Found that the mirror was successfully pulled

execute docker images

[root@bogon ~]# docker images
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
docker.io/learn/tutorial   latest              a7876479f1aa        4 years ago         128 MB
[root@bogon ~]#

If you see the above output, it means that you can use the image "docker.cn/docker/centos", or call it a repository, which has a tag called "latest", and also There is an image ID called "a7876479f1aa" (maybe the one you see here is not the same as the one here, that's normal as this number is randomly generated). In addition, we can see that the image is only 128 MB, which is very small, not as large as the image file of the virtual machine.

Now that the image is available, we need to use the image below to start the container

start the container

The container runs on the basis of the image. Once the container is started, we can log in to the container and install the software or applications we need. Now that the image has been downloaded locally, how can we start the container?

Just use the following command to start the container:

docker run -i -t -v /root/software/:/mnt/software/ a7876479f1aa /bin/bash

 This command is relatively long. Let's break it down a little. It actually contains the following three parts:

docker run <相关参数> <镜像 ID> <初始命令>

Among them, the relevant parameters include:

  • -i: means run the container in "interactive mode"
  • -t: Indicates that the container will enter its command line after startup
  • -v:表示需要将本地哪个目录挂载到容器中,格式:-v <宿主机目录>:<容器目录>

假设我们的所有安装程序都放在了宿主机的/root/software/目录下,现在需要将其挂载到容器的/mnt/software/目录下。

需要说明的是,不一定要使用“镜像 ID”,也可以使用“仓库名:标签名”,例如:docker.io/learn/tutorial latest

初始命令表示一旦容器启动,需要运行的命令,此时使用“/bin/bash”,表示什么也不做,只需进入命令行即可。

随后,可使用如下命令查看正在运行的容器:

docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
da91e745434b        a7876479f1aa        "/bin/bash"         5 minutes ago       Up 4 minutes                            hungry_fermi

发现刚才运行的容器在这里出现了
接下来执行docker version
[root@bogon ~]# docker version
Client:
 Version:         1.12.6
 API version:     1.24
 Package version: docker-1.12.6-71.git3e8e77d.el7.centos.1.x86_64
 Go version:      go1.8.3
 Git commit:      3e8e77d/1.12.6
 Built:           Tue Jan 30 09:17:00 2018
 OS/Arch:         linux/amd64

Server:
 Version:         1.12.6
 API version:     1.24
 Package version: docker-1.12.6-71.git3e8e77d.el7.centos.1.x86_64
 Go version:      go1.8.3
 Git commit:      3e8e77d/1.12.6
 Built:           Tue Jan 30 09:17:00 2018
 OS/Arch:         linux/amd64
发现 Server端也有了

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326021790&siteId=291194637