【Docker启动与镜像拉取】

一、启动状态才能Docker Images

【Docker启动与镜像拉取】_第1张图片
二、设置镜像加速器

【Docker启动与镜像拉取】_第2张图片
 三、开始下载镜像

【Docker启动与镜像拉取】_第3张图片
三、下载镜像Nginx Tomcat Mysql

【Docker启动与镜像拉取】_第4张图片
 

附件:镜像加速器设置方法

[root@bogon ~]# cat /etc/docker/daemon.json 

{"registry-mirrors": ["https://hccwwfjl.mirror.aliyuncs.com"]}

[root@bogon  ~]# systemctl daemon-reload

[root@bogon ~]# systemctl restart docker

 

[root@bogon ~]# docker images

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

[root@bogon ~]# systemctrl start docker

-bash: systemctrl: command not found

[root@bogon ~]# system

systemctl                       systemd-coredumpctl             systemd-inhibit                 systemd-run

systemd-analyze                 systemd-delta                   systemd-loginctl                systemd-stdio-bridge

systemd-ask-password            systemd-detect-virt             systemd-machine-id-setup        systemd-sysv-convert

systemd-cat                     systemd-escape                  systemd-notify                  systemd-tmpfiles

systemd-cgls                    systemd-firstboot               systemd-nspawn                  systemd-tty-ask-password-agent

systemd-cgtop                   systemd-hwdb                    systemd-path                    

[root@bogon ~]# systemctl start docker

[root@bogon ~]# docker status

docker: 'status' is not a docker command.

See 'docker --help'

[root@bogon ~]# docker images          

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

[root@bogon ~]# docker info

Containers: 0

 Running: 0

 Paused: 0

 Stopped: 0

Images: 0

Server Version: 1.13.1

Storage Driver: overlay2

 Backing Filesystem: xfs

 Supports d_type: true

 Native Overlay Diff: true

Logging Driver: journald

Cgroup Driver: systemd

Plugins: 

 Volume: local

 Network: bridge host macvlan null overlay

Swarm: inactive

Runtimes: docker-runc runc

Default Runtime: docker-runc

Init Binary: /usr/libexec/docker/docker-init-current

containerd version:  (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)

runc version: 5eda6f6fd0c2884c2c8e78a6e7119e8d0ecedb77 (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)

init version: fec3683b971d9c3ef73f284f176672c44b448662 (expected: 949e6facb77383876aeff8a6944dde66b3089574)

Security Options:

 seccomp

  WARNING: You're not using the default seccomp profile

  Profile: /etc/docker/seccomp.json

 selinux

Kernel Version: 3.10.0-862.el7.x86_64

Operating System: CentOS Linux 7 (Core)

OSType: linux

Architecture: x86_64

Number of Docker Hooks: 3

CPUs: 1

Total Memory: 488 MiB

Name: bogon

ID: LRX6:LXIG:FCIK:FVDQ:PDXC:5DGP:HTUI:XC7M:CENZ:2QZF:LKD3:PBSL

Docker Root Dir: /var/lib/docker

Debug Mode (client): false

Debug Mode (server): false

Registry: https://index.docker.io/v1/

Experimental: false

Insecure Registries:

 127.0.0.0/8

Live Restore Enabled: false

Registries: docker.io (secure)

[root@bogon ~]# docker pull tomcat:8.5.16

Trying to pull repository docker.io/library/tomcat ... 

8.5.16: Pulling from docker.io/library/tomcat

06b22ddb1913: Pulling fs layer 

336c28b408ed: Pulling fs layer 

1f3e6b8d80c3: Pulling fs layer 

aeac59510475: Waiting 

b01db8bd8540: Waiting 

f7f398af5fea: Waiting 

1c5595fa1317: Waiting 

e1a6cc83dc3d: Waiting 

9efe1c932022: Waiting 

eef936b7f842: Waiting 

3c1e71063aec: Waiting 

e4baeac59d4b: Waiting 

52da60bb1e3e: Waiting 

error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/b2/b226d7ee3462843cc6a38d62cec7a6634b452fbee580c180776e7dc8860244ab/data?verify=1535811566-1pWAiMIFGKf%2FaAdaNMJahfmgAF8%3D: net/http: TLS handshake timeout

[root@bogon ~]# docker pull tomcat:8.5.16

Trying to pull repository docker.io/library/tomcat ... 

8.5.16: Pulling from docker.io/library/tomcat

06b22ddb1913: Downloading 

336c28b408ed: Downloading 

1f3e6b8d80c3: Waiting 

aeac59510475: Waiting 

b01db8bd8540: Waiting 

f7f398af5fea: Pulling fs layer 

1c5595fa1317: Pulling fs layer 

e1a6cc83dc3d: Pulling fs layer 

9efe1c932022: Pulling fs layer 

eef936b7f842: Pulling fs layer 

3c1e71063aec: Pulling fs layer 

e4baeac59d4b: Pulling fs layer 

52da60bb1e3e: Pulling fs layer 

error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/b2/b226d7ee3462843cc6a38d62cec7a6634b452fbee580c180776e7dc8860244ab/data?verify=1535811630-n0P6p%2FFQhg9vDDVqMOvrr%2FVfFck%3D: net/http: TLS handshake timeout

[root@bogon ~]# systemctl restart docker

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

[root@bogon ~]# ps -ef |grep docker

root      1747  1480  0 09:40 pts/0    00:00:00 grep --color=auto docker

[root@bogon ~]# systemctl start docker  

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

[root@bogon ~]# docker info

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

[root@bogon ~]# systemctl start docker   

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

[root@bogon ~]# reboot

Connection timed out

Last login: Sat Sep  1 09:42:42 2018

[root@bogon ~]# systemctl start docker

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

[root@bogon ~]# systemctl start docker

[root@bogon ~]# docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

[root@bogon ~]# docker pull tomcat:8.5.16  

Trying to pull repository docker.io/library/tomcat ... 

8.5.16: Pulling from docker.io/library/tomcat

06b22ddb1913: Pull complete 

336c28b408ed: Pull complete 

1f3e6b8d80c3: Pull complete 

aeac59510475: Pull complete 

b01db8bd8540: Pull complete 

f7f398af5fea: Pull complete 

1c5595fa1317: Pull complete 

e1a6cc83dc3d: Pull complete 

9efe1c932022: Pull complete 

eef936b7f842: Pull complete 

3c1e71063aec: Pull complete 

e4baeac59d4b: Pull complete 

52da60bb1e3e: Pull complete 

Digest: sha256:b3ba28259a92964d8026cf28bea8b9117732cdd6597e2598939c5dee4fd60efa

Status: Downloaded newer image for docker.io/tomcat:8.5.16

[root@bogon ~]# docker images            

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

docker.io/tomcat    8.5.16              b226d7ee3462        13 months ago       292 MB

[root@bogon ~]#  docker search nginx

INDEX       NAME                                                             DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED

docker.io   docker.io/nginx                        Official build of Nginx.                        9463      [OK]       

docker.io   docker.io/jwilder/nginx-proxy       Automated Nginx reverse proxy for docker c...   1394    [OK]

docker.io   docker.io/richarvey/nginx-php-fpm       Container running Nginx + PHP-FPM capable ...   610           [OK]

docker.io   docker.io/jrcs/letsencrypt-nginx-proxy-companion     LetsEncrypt container to use with nginx as...   398                  [OK]

docker.io   docker.io/kong                                                   Open-source Microservice & API Management ...   222       [OK]       

docker.io   docker.io/webdevops/php-nginx                                    Nginx with PHP-FPM                              113                  [OK]

docker.io   docker.io/kitematic/hello-world-nginx                            A light-weight nginx container that demons...   108                  

docker.io   docker.io/zabbix/zabbix-web-nginx-mysql                          Zabbix frontend based on Nginx web-server ...   64                   [OK]

docker.io   docker.io/bitnami/nginx                                          Bitnami nginx Docker Image                      58                   [OK]

docker.io   docker.io/1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5   ubuntu-16-nginx-php-phpmyadmin-mysql-5          43                   [OK]

docker.io   docker.io/linuxserver/nginx                                      An Nginx container, brought to you by Linu...   38                   

docker.io   docker.io/tobi312/rpi-nginx                                      NGINX on Raspberry Pi / armhf                   20                   [OK]

docker.io   docker.io/blacklabelops/nginx                                    Dockerized Nginx Reverse Proxy Server.          12                   [OK]

docker.io   docker.io/nginxdemos/nginx-ingress                               NGINX Ingress Controller for Kubernetes . ...   11                   

docker.io   docker.io/wodby/drupal-nginx                                     Nginx for Drupal container image                10                   [OK]

docker.io   docker.io/nginxdemos/hello                                       NGINX webserver that serves a simple page ...   8                    [OK]

docker.io   docker.io/webdevops/nginx                                        Nginx container                                 8                    [OK]

docker.io   docker.io/centos/nginx-18-centos7                                Platform for running nginx 1.8 or building...   7                    

docker.io   docker.io/centos/nginx-112-centos7                               Platform for running nginx 1.12 or buildin...   5                    

docker.io   docker.io/1science/nginx                                         Nginx Docker images that include Consul Te...   4                    [OK]

docker.io   docker.io/pebbletech/nginx-proxy                                 nginx-proxy sets up a container running ng...   2                    [OK]

docker.io   docker.io/mailu/nginx                                            Mailu nginx frontend                            1                    [OK]

docker.io   docker.io/toccoag/openshift-nginx                                Nginx reverse proxy for Nice running on sa...   1                    [OK]

docker.io   docker.io/travix/nginx                                           NGinx reverse proxy                             1                    [OK]

docker.io   docker.io/ansibleplaybookbundle/nginx-apb                        An APB to deploy NGINX                          0                    [OK]

[root@bogon ~]# docker pull nginx

Using default tag: latest

Trying to pull repository docker.io/library/nginx ... 

latest: Pulling from docker.io/library/nginx

be8881be8156: Pull complete 

65206e5c5e2d: Pull complete 

8e029c3e2376: Pull complete 

Digest: sha256:1b109555ad28bb5ec429422ee136c5f5ab5ee6faaeb518836a5c9a3b6436a1bd

Status: Downloaded newer image for docker.io/nginx:latest

[root@bogon ~]# docker images       

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

docker.io/nginx     latest              71c43202b8ac        2 days ago          109 MB

docker.io/tomcat    8.5.16              b226d7ee3462        13 months ago       292 MB

[root@bogon ~]# docker pull mysql

Using default tag: latest

Trying to pull repository docker.io/library/mysql ... 

latest: Pulling from docker.io/library/mysql

be8881be8156: Already exists 

c3995dabd1d7: Pull complete 

9931fdda3586: Pull complete 

bb1b6b6eff6a: Pull complete 

a65f125fa718: Pull complete 

2d9f8dd09be2: Pull complete 

37b912cb2afe: Pull complete 

54242fcd8eaa: Pull complete 

0a9d4d211511: Pull complete 

270ae5bd02c2: Pull complete 

9b55b8e72e70: Pull complete 

68083f7985cd: Pull complete 

Digest: sha256:d39a8ab7679df309e7eff6ddba434ad5747cc2a2acee2d7c60d8221c9acedcad

Status: Downloaded newer image for docker.io/mysql:latest

[root@bogon ~]# docker images    

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

docker.io/nginx     latest              71c43202b8ac        2 days ago          109 MB

docker.io/mysql     latest              29e0ae3b69b9        2 weeks ago         484 MB

docker.io/tomcat    8.5.16              b226d7ee3462        13 months ago       292 MB

[root@bogon ~]# 

 

 

设置镜像加速器

Last login: Sat Sep  1 09:22:59 2018 from 192.168.1.102

[root@bogon ~]# cat /etc/docker/

certs.d/      daemon.json   key.json      seccomp.json  

[root@bogon ~]# cat /etc/docker/

certs.d/      daemon.json   key.json      seccomp.json  

[root@bogon ~]# cat /etc/docker/daemon.json 

{}

[root@bogon ~]# echo {"registry-mirrors": ["https://hccwwfjl.mirror.aliyuncs.com"]}

{registry-mirrors: [https://hccwwfjl.mirror.aliyuncs.com]}

[root@bogon ~]# echo {"registry-mirrors": ["https://hccwwfjl.mirror.aliyuncs.com"]} > /etc/docker/daemon.json 

[root@bogon ~]# cat /etc/docker/daemon.json                                        

{registry-mirrors: [https://hccwwfjl.mirror.aliyuncs.com]}

[root@bogon ~]# 

 

Connection timed out

 

Last login: Sat Sep  1 09:42:51 2018 from 192.168.1.102

[root@bogon ~]# 

[root@bogon ~]# vi  /etc/docker/daemon.json                                                                      

{"registry-mirrors": ["https://hccwwfjl.mirror.aliyuncs.com"]}

                                                                                

"/etc/docker/daemon.json" 1L, 63C written

[root@bogon ~]# cat /etc/docker/daemon.json 

{"registry-mirrors": ["https://hccwwfjl.mirror.aliyuncs.com"]}

[root@bogon ~]# 

你可能感兴趣的:(Docker)