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 startsystemctl start dockersystemctl start docker.service

3.查看docker启动状态:systemctl status docker

4.设置docker开启自启动:systemctl enable docker

5.停止docker服务:service docker stopsystemctl stop docker

6.重启docker服务:service docker restartsystemctl restart docker

posted @ 2021-09-15 14:00  TBHacker  阅读(40)  评论(0编辑  收藏  举报