CentOS修改yum源及docker,docker-compose的安装

CentOS修改yum源及docker,docker-compose的安装

更改yum源

1,备份原yum仓库

# yum install wget -y
# cd /etc/yum.repos.d/
# mv CentOS-Base.repo CentOS-Base.repo.backup

2,下载163源

# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
# yum makecache

3,测试

# yum install vim -y

安装Docker

1,移除旧版本

# yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine

2,安装依赖

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

3,添加docker源,安装docker-ce

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

4,启动docker服务并添加开机启动

# systemctl start docker
# systemctl enable docker

5,测试

# docker run hello-world

6,修改docker镜像源
# vim /etc/docker/daemon.json(没有的话新建该文件)

{ "registry-mirrors": ["http://hub-mirror.c.163.com"] }

安装docker-compose

1,首先检查是否安装pip

# pip -V

如果没有安装pip,执行如下命令

# yum install epel-release -y
# yum install python-pip -y
# pip install --upgrade pip

2,安装docker-compose

# pip install docker-compose

如出现报错ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out报错,使用如下命令进行安装

# pip --default-timeout=200 install -U docker-compose

3,测试

# docker-compose -version

你可能感兴趣的:(Linux点滴,Docker点滴)