Docker安装官方分为以下手动安装和一键安装脚本两种方式,安装流程非常简单.
升级yum
yum update
安装依赖包
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-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
排序查看仓库内文件
yum list docker-ce --showduplicates | sort -r
安装最新版Docker
sudo yum install docker-ce docker-ce-cli containerd.io
下载一键安装脚本
curl -fsSL https://get.docker.com -o get-docker.sh
运行一键安装脚本(阿里云加速镜像)
sudo sh get-docker.sh --mirror Aliyun
启动Docker
sudo systemctl start docker
查看Docker版本
sudo docker version
设置Docker开机自动启动
sudo systemctl enable docker
# yum remove docker docker-common docker-selinux docker-engine
正在折腾测试些docker容器,用到docker compose功能,记录一下安装流程.
CentOS 7 上Docker的安装方法参考:
官网选择版本 https://github.com/docker/compose/releases
以下命令手动修改版本号,例如1.24.1
curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
添加执行权限
chmod +x /usr/local/bin/docker-compose
检查docker compose版本
docker-compose version
官网选择版本
https://github.com/docker/compose/releases
选择相应版本,下载docker-compose-Linux-x86_64到本地或者服务器中
更名为docker-compose
,并移动到 /usr/local/bin 目录下
添加执行权限
chmod +x /usr/local/bin/docker-compose
检查docker compose版本
docker-compose version
安装依赖
yum -y install epel-release
安装PIP
yum -y install python-pip
升级PIP
pip install --upgrade pip
检查PIP版本
pip --version
pip 19.3.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)
安装docker compose,自行更改版本号.
pip install -U docker-compose==1.24.1
检查docker compose版本
docker-compose version
ERROR: Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
升级安装requests库
pip install -I requests==2.10.0
再次安装docker compose
pip install -U docker-compose==1.24.1
[...]安装 Docker - 参考笔记 - ? CentOS 7 安装 Docker[...]