CentOS安装docker

安装docker

安装docker – https://docs.docker.com/engine/install/centos/

卸载旧版

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

安装yum工具

sudo yum install -y yum-utils

添加docker库

sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
rpm --import https://download.docker.com/linux/centos/gpg

确认GPG 密钥 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35

安装docker

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

设置docker服务

sudo systemctl enable docker
sudo systemctl start docker

一键安装

curl -fsSL https://get.docker.com | bash

安装docker-compose – https://docs.docker.com/compose/install/

sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

完成

上一篇
下一篇