docker docker-compose 安装
查看安装过的docker包
yum list installed | grep dockerm
卸载旧版本
yum remove docker docker-common docker-selinux docker-engine
yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的
yum install -y yum-utils device-mapper-persistent-data lvm2
设置stable镜像仓库
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
或
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装docker
yum -y install docker-ce.x86_64
启动
systemctl start docker
开机启动
sudo systemctl enable docker
默认没有daemon.json这个文件
vi /etc/docker/daemon.json
添加
----------------------------------daemon.json-----------------------------------------------
{
"registry-mirrors": ["https://y0qd3iq.mirror.aliyuncs.com"],//修改源
"graph":"/disk/docker/lib"//修改镜像保存地址
}
--------------------------------------------------------------------------------------------------
重启docker服务
systemctl restart docker 或者 service restart docker
查看配置是否生效
docker info
安装docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
网络无法下载
将docker-compose 上传至/usr/local/bin
赋予权限
sudo chmod +x /usr/local/bin/docker-compose
查看版本
docker-compose -versioin