docker

一、docker安装

安装需要的

yum -y install gcc
yum -y install gcc-c++

1:卸载旧的版本

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2:设置存储库

sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

3:安装 Docker 引擎 (最新版本)

sudo yum install docker-ce docker-ce-cli containerd.io

4:启动docker

sudo systemctl start docker

5:验证

docker --version

6:配置阿里云的镜像加速器

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://wwecv9pf.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

7:常用命令

# 启动docker:
systemctl start docker

# 停止docker:
systemctl stop docker
  
# 重启docker:
systemctl restart docker

# 查看docker状态:
systemctl status docker

# 开机启动:  
systemctl enable docker

# 查看docker概要信息
docker info

# 查看docker帮助文档
docker --help

 

上一篇:MySQL5.7安装与配置


下一篇:部署YUM仓库及NFS共享服务