实战dock安装和镜像的拉取
一.系統環境
[root@weblamp ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[root@weblamp ~]#
二.yum安裝
[root@weblamp ]# yum install -y epel-release
[root@weblamp ]# yum install -y docker-io
[root@weblamp ]# ll /etc/sysconfig/docker
-rw-r--r-- 1 root root 530 Aug 15 2015 /etc/sysconfig/docker
[root@weblamp ]# service docker start
Starting cgconfig service: [ OK ]
Starting docker: [ OK ]
[root@weblamp ]# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64
[root@weblamp ]#
三.配置加速器地址:
使用自己的阿里云賬號,登錄阿里云dock 容器,獲取自己的dock鏡像地址。
[root@weblamp ~]# vim /etc/sysconfig/docker
other_args="--registry-mirror=https://amcoo07e.mirror.aliyuncs.com"
root@weblamp ~]# vim /etc/sysconfig/docker
[root@weblamp ~]# service docker restart
Stopping docker: [ OK ]
Starting docker: [ OK ]
檢查配置是否成功
[root@weblamp ~]# ps -ef |grep docker
root 1363 1 0 09:59 pts/0 00:00:00 /usr/bin/docker -d --registry-
mirror=https://amcoo07e.mirror.aliyuncs.com
root 1410 1262 0 09:59 pts/0 00:00:00 grep docker
四.運行 hello-world
[root@weblamp ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from hello-world
65b27d3bd74d: Pull complete
9f5834b25059: Pull complete
Digest: sha256:fb158b7ad66f4d58aa66c4455858230cd2eab4cdf29b13e5c3628a6bfc2e9f05
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
..........
#列出本地鏡像
[root@weblamp ~]# docker images?
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
hello-world latest 9f5834b25059 4 days ago 1.84 kB
?#列出所有的鏡像含中間鏡像層 -a:all
[root@weblamp ~]# docker images -a
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
hello-world latest 9f5834b25059 4 days ago 1.84 kB
<none> <none> 65b27d3bd74d 4 days ago 1.84 kB
?
轉載于:https://www.cnblogs.com/ahtornado/p/10299831.html
總結
以上是生活随笔為你收集整理的实战dock安装和镜像的拉取的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数据库-数据类型及主键外键
- 下一篇: 关于 JS 模块化的最佳实践总结