docker2019.png

安装Docker

转自: https://jalena.bcsytv.com/archives/2294

Docker要求Centos系统的内核版本高于3.10,因此在安装前你需要知道你的系统是否支持Docker安装的最低内核要求

# 查看电脑中已安装的Docker程序
yum list installed | grep docker

# 卸载Docker及相关程序
rpm -qa | grep docker | xargs rpm -e

# 手动卸载
yum remove docker  docker-common docker-selinux docker-engine

安装需要的软件包及设置docker安装源

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

查看仓库中所有的docker版本

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

安装Docker

yum install docker-ce
# 安装特定的版本
yum install <FQPN>
# 验证安装
docker -v

设置开机启动

systemctl start docker
systemctl enable docker

安装Docker-Compose

你可以在 https://github.com/docker/compose/releases 找到你需要的Docker-compose版本。

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

# 下载
curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

# 赋予执行权限
chmod +x /usr/local/bin/docker-compose

# 映射执行路径
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

设置Docker 加速

阿里云:https://cr.console.aliyun.com/#/accelerator

cd /etc/docker
vim daemon.json 

在文件中粘贴下面内容:

{ "registry-mirrors": ["https://wkumpv63.mirror.aliyuncs.com"]}

最后重启docker

sudo systemctl daemon-reload
sudo systemctl restart docker

--END

Last modification:April 24th, 2020 at 02:39 pm
If you think my article is useful to you, please feel free to appreciate