Centos7.6安装docker最新稳定版本及docker-compose

系统版本:Centos 7.6

1.卸载旧版本

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

2.安装Docker Engine  ce版本

建立源

$ sudo yum install -y yum-utils \
                    device-mapper-persistent-data \
                    lvm2

配置源

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

安装

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

也可以下载指定稳定版本

$ yum list docker-ce --showduplicates | sort -r

Centos7.6安装docker最新稳定版本及docker-compose_第1张图片

可以根据列表下载指定的版本

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

3.启动Docker 进程

$ sudo systemctl start docker 

4.验证是否正常启动

$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

5.安装docker-compose

$ curl -L "https://github.com/docker/compose/releases/download/1.24.1/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

 

参考,Docker 官方安装手册:

https://docs.docker.com/install/linux/docker-ce/centos/

https://docs.docker.com/compose/install/

你可能感兴趣的:(Docker,技术文档)