CentOS 7 安装 Docker小记

August 31, 2018 访问: 371 次

安装:

yum install docker

安装后启动:

[root@localhost ~]# sudo service docker start
Redirecting to /bin/systemctl start docker.service

设置开机启动

[root@localhost ~]# sudo chkconfig docker on
注意:正在将请求转发到“systemctl enable docker.service”。
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

搜索镜像

docker search centos

下载 centos

docker pull centos

列出本地镜像

docker images

运行

docker run -ti centos /bin/bash
$ docker run -idt 5182e96772bf
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
e2352ff2b606        5182e96772bf        "/bin/bash"         2 minutes ago       Up 2 minutes                            quizzical_ritchie
$ docker top e2352ff2b606
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                23916               23901               0                   22:23               pts/1               00:00:00            /bin/bash
$ nsenter --target 23916 --mount --uts --ipc --net --pid

添加新评论