Centos 安装Docker
安装必要的系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
添加软件源信息
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新docker-ce
sudo yum makecache fast
sudo yum -y install docker-ce
启动docker
sudo service docker start
# ps -ef | grep docker
root 12733 1 3 13:55 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 12985 15420 0 13:55 pts/2 00:00:00 grep --color=auto docker
常用指令
1.查看docker版本信息: docker version
2.开启docker服务:service docker start
或systemctl start docker
或systemctl start docker.service
3.查看docker启动状态:systemctl status docker
4.设置docker开启自启动:systemctl enable docker
5.停止docker服务:service docker stop
或systemctl stop docker
6.重启docker服务:service docker restart
或 systemctl restart docker