Centos 安装 docker 及 docker-compose
本文最后更新于 529 天前,其中的信息可能已经有所发展或是发生改变。

docker

#升级yum
sudo yum update
#卸载旧版本docker
sudo yum remove docker  docker-common docker-selinux docker-engine
#安装依赖
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
#设置缓存
sudo yum makecache fast
#安装docker
sudo yum install docker-ce
#启动服务
sudo systemctl start docker
#设置开机自启
sudo systemctl enable docker.service
#查看版本
docker version

docker-compose

#下载
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
#给权限
sudo chmod +x /usr/local/bin/docker-compose
#查看版本
docker-compose -v

Dabian

apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  tee /etc/apt/sources.list.d/docker.list > /dev/null
 apt-get update
apt-get install docker-ce

暂无评论

发送评论 编辑评论


				
下一篇