centos7安装docker
记录一下安装docker的步骤,免得以后在网上找来找去的。
安装步骤
# 1: 安装必要的一些系统工具
yum install -y yum-utils device-mapper-persistent-data lvm2
# 2: 添加软件源信息
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 3: 更新并安装Docker-CE
yum makecache fast
yum -y install docker-ce
# 4:开机启动docker
systemctl enable docker.service
systemctl start docker.service
# 查看状态
systemctl status docker.service
校验安装
[root@192 ~]# docker version
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:27:04 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:25:42 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
阿里云加速docker镜像源
# 1.注册容阿里云 器镜像服务 得到加速地址
# 2.配置加速地址 xxxx 替换为自己的地址
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://t2g9rte2.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
安装docker-compose
# 安装epel-release依赖
yum -y install epel-release
# 安装docker-compose v2.12.2,对应版本自行替换
curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 授权docker-compose执行
chmod +x /usr/local/bin/docker-compose
# 建立软连接
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# 查看版本
docker-compose version
原创内容,如果你觉得文章还可以的话,不妨点个赞支持一下!转载请注明出处。