docker安装笔记

环境:centos7.6

[root@tzh ~]# uname -a
Linux tzh 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

docker安装()

1、yum安装gcc相关

yum install -y gcc gcc-c++

2、卸载旧版本(如果没有安装过不用执行)

yum remove docker \

docker-client \

docker-client-latest \

docker-common \

docker-latest \

docker-latest-logrotate \

docker-logrotate \

docker-selinux \

docker-engine-selinux \

docker-engine

3、安装需要的依赖包

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

4、设置stable镜像仓库

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

5、更新yum软件包索引

yum makecache fast

6、安装docker-ce

yum install -y docker-ce

7、启动docker

systemctl start docker

8、查看版本

docker version

9、测试是否能正常使用

docker run hello-world

10、配置镜像加速(自己到阿里云,找到自己专属的加速地址)

您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器

sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker

再次进行测试,发现速度快了很多。

docker run hello-world

11、卸载

systemctl stop docker

yum -y remove docker

rm -rf /var/lib/docker

 

posted @ 2020-06-25 17:12  taotaozh  阅读(190)  评论(0编辑  收藏  举报