美文网首页
Docker安装

Docker安装

作者: perfect_jimmy | 来源:发表于2017-03-10 13:48 被阅读90次

第一部分:安装

1.查看系统版本:cat /etc/redhat-release

2.安装:yum install docker

3.检查是否成功:docker version

4.启动docker:

systemctl start docker.service
systemctl enable docker.service

5.查看docker信息:docker info

第二部分:使用

1.检索名字为tutorial的镜像:docker search tutorial

2.下载镜像:docker install learn/tutorial

3.查看下载的镜像:docker images

4.在docker中运行hello world:docker run learn/tutorial echo "hello world"
说明:*docker run命令有两个参数,一个是镜像名,一个是要在镜像中运行的命令 *

5.在docker中安装wget命令:docker run learn/tutorial apt-get install -y wget

6.查看容器Id:docker ps -l

[root@host-10-10-10-12 ~]# docker ps -l 
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                      PORTS               NAMES
1ced4f9a977b        learn/tutorial      "apt-get install -y w"   About a minute ago   Exited (0) 58 seconds ago                       tender_murdock

7.保存对容器的修改并命名为learn/wget:docker commit 1ced4f9a977b learn/wget

[root@host-10-10-10-12 ~]# docker ps -l 
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                      PORTS               NAMES
1ced4f9a977b        learn/tutorial      "apt-get install -y w"   About a minute ago   Exited (0) 58 seconds ago                       tender_murdock

8.检查运行中的镜像:docker inspect a7953f439817

相关文章

网友评论

      本文标题:Docker安装

      本文链接:https://www.haomeiwen.com/subject/hwebgttx.html