docker安装教程
系统环境linux版本:centos7[root@zk1 ~]# uname -r3.10.0-327.el7.x86_64[root@zk1 ~]# cat /etc/redhat-releaseCentOS Linux release 7.2.1511 (Core) 安装步骤更新yumyum update安装dockeryum install docker安装成功后查看docker
·
系统环境
linux版本:centos7
[root@zk1 ~]# uname -r
3.10.0-327.el7.x86_64
[root@zk1 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
安装步骤
- 更新yum
yum update
- 安装docker
yum install docker
安装成功后查看docker版本
docker version
[root@zk1 docker]# docker version Client: Version: 1.10.3 API version: 1.22 Package version: docker-common-1.10.3-46.el7.centos.14.x86_64 Go version: go1.6.3 Git commit: cb079f6-unsupported Built: Fri Sep 16 13:24:25 2016 OS/Arch: linux/amd64 Cannot connect to the Docker daemon. Is the docker daemon running on this host? You have new mail in /var/spool/mail/root
启动docker服务
[root@zk1 docker]# /bin/systemctl start docker.service
- 再次查看docker版本:
[root@zk1 docker]# docker version
Client:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-46.el7.centos.14.x86_64
Go version: go1.6.3
Git commit: cb079f6-unsupported
Built: Fri Sep 16 13:24:25 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-46.el7.centos.14.x86_64
Go version: go1.6.3
Git commit: cb079f6-unsupported
Built: Fri Sep 16 13:24:25 2016
OS/Arch: linux/amd64
docker初体验
- 下载安装镜像
tutorial
docker search tutorial
docker pull learn/tutorial
- 运行自带的
helloword
程序
[root@zk2 software]# docker run learn/tutorial echo “hello word”
“hello word”
- 在容器中安装新的程序(wget命令)
[root@zk2 software]# docker run learn/tutorial apt-get install -y wget
- 使用docker ps -l命令获得安装完ping命令之后容器的id。然后把这个镜像保存为learn/wget。
[root@zk2 software]# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
421401d23ba8 learn/tutorial "apt-get install -y w" 2 minutes ago Exited (0) 2 minutes ago suspicious_lamarr
- 保存对容器的修改
421401d23ba8
为上面container编号
[root@zk2 software]# docker commit 421401d23ba8 learn/wget
sha256:1a444d64177690c5384db52e10bf5b99722bc486adff7a2723ff8b05d3255136
- 检查运行中的镜像
docker inspect 421401d23ba8
- 发布自己的镜像
a. 首先在https://cloud.docker.com 注册,并且创建一个Repositories
b. 将刚才我们做的镜像起个新的名字[root@zk2 software]# docker tag learn/wget:latest 852026881/learn:latest
c. 在命令行登录[root@zk2 software]# docker login
d. 上传[root@zk2 software]# docker push 852026881/learn:latest
至此,整个docker的使用已体验完啦!
更多推荐
已为社区贡献3条内容
所有评论(0)