[root@localhost software]# yum install libseccomp.x86_64 [root@localhost software]# yum install container-selinux.noarch
[root@localhost software]# rpm -i ./containerd.io-1.2.6-3.3.el7.x86_64.rpm [root@localhost software]# rpm -i ./docker-ce-cli-19.03.9-3.el7.x86_64.rpm [root@localhost software]# rpm -i ./docker-ce-19.03.9-3.el7.x86_64.rpm
[root@localhost software]# systemctl start docker
[root@localhost software]# docker search CentOS NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos The official build of CentOS. 6029 [OK] ansible/centos7-ansible Ansible on Centos7 129 [OK] ……
CentOS镜像获取地址:https://hub.docker.com/_/centos?tab=tags
[root@localhost software]# docker pull centos:centos7 centos7: Pulling from library/centos 524b0c1e57f8: Pull complete ……
[root@localhost software]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos centos7 b5b4d78bc90c 4 weeks ago 203MB
[root@localhost software]# docker run -itd --name centos-node1 centos:centos7 4c619a88c1eb3a546e53858826a71daf80a8fc41fae17d53c67c80f671e71f2a
[root@localhost software]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4c619a88c1eb centos:centos7 "/bin/bash" 7 seconds ago Up 7 seconds centos-node1
通过 exec 命令对指定的容器执行 bash:
[root@localhost software]# docker exec -it centos-node1 /bin/bash