yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
yum install -y yum-utils
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce docker-ce-cli containerd.io
注意 安装时 出现 container-selinux >= 2.9 解决办法:
#进入yum 源配置文件夹 cd /etc/yum.repos.d mv CentOS-Base.repo
CentOS-Base.repo_bak在文件顶部添加一个条目/etc/yum.repos.d/docker-ce.repo,内容如下:
[centos-extras]
name=Centos extras - $basearch
baseurl=http://mirror.centos.org/centos/7/extras/x86_64 enabled=1
gpgcheck=0保存退出
#然后安装命令: yum -y install slirp4netns fuse-overlayfs container-selinux
# 启动docker
systemctl start docker
# 开机自启
systemctl enable docker
1.在 /etc/docker/daemon.json 文件中添加以下参数(没有该文件则新建):
{
"registry-mirrors": [
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com"
]
}
2.重启
sudo systemctl daemon-reload
sudo systemctl restart docker
curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.5/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
没有安装 curl 的先安装,安装包的安装方式如下
从官网下载安装包:https://github.com/docker/compose/releases/tag/1.25.0-rc4
,将安装包放置 /usr/local/bin 目录下,并改名为 docker-compose
chmod +x /usr/local/bin/docker-compose