Loading

Centos7下安装Docker

1、首先卸载旧版:

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

2、安装依赖包:

yum install -y yum-utils device-mapper-persistent-data lvm2

3、设置安装源(阿里云):

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

4、启用测试库(可选):

yum-config-manager --enable docker-ce-edge
yum-config-manager --enable docker-ce-test

5、安装:

yum makecache
yum install -y docker-ce

6、启动:

systemctl start docker

开机自启

systemctl enable docker

 

7、配置镜像加速器(可选):

https://www.cnblogs.com/hackyo/p/9613465.html

8、测试:

docker run hello-world

 9、安装docker-compose(可选):

命令里的版本号可以去这里查找最新的:https://github.com/docker/compose/releases

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64" -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-compose:

docker-compose --version
posted @ 2018-07-08 14:55  hackyo  阅读(1863)  评论(0编辑  收藏  举报