docker/docker-compose安装

安装

卸载旧版本

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

设置存储库

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

安装

1.安装最新版本的Docker Engine和容器

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

2.启动Docker

$ sudo systemctl start docker

3.测试

$ sudo docker run hello-world

4.卸载

$ sudo yum remove docker-ce docker-ce-cli containerd.io
$ sudo rm -rf /var/lib/docker

下载Compose

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

授权

$ sudo chmod +x /usr/local/bin/docker-compose

测试

$ docker-compose --version

若已安装python,也可通过pip进行安装

pip install docker-compose
pip uninstall docker-compose