yum 安装docker
安装docker 1.13.0
1.安装yum源
curl -f sSL https://get.docker.com/ | sh -s -- --mirror AzureChinaCloud
或:
wget https://docs.docker.com/v1.13/engine/installation/linux/repo_files/centos/docker.repo
2.安装最新版的docker
yum makecache fast
yum -y install docker-engine
或者安装其他版本docker
yum list docker-engine.x86_64 --showduplicates |sort -r
yum -y install docker-engine-<VERSION_STRING>
3.把当前用户加入docker用户组
sudo groupadd docker
sudo usermod -aG docker $USER
yum 安装docker 1.26
1.配置docker yum 源
cat > /etc/yum.repos.d/docker.repo <<-EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/experimental/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
2.安装组件
yum -y install docker-engine
curl -fsSL https://get.docker.com/ | sh 或者 wget -qO- https://get.docker.com/ |sh
3.启动
systemctl start docker 启动 docker
systemctl enable docker 设置开机启动
4.docker-compose环境安装
yum install python-pip -y
pip install docker-compose
docker-compose -version
下载二进制可执行文件的方式安装Docker-compose(推荐)
curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
5.docker加速(链接为阿里云docker镜像仓库,登录即可领取属于你的加速地址)
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://av7k0o0o.mirror.aliyuncs.com"]
}
6.harbor 删除镜像及资源回收
$ docker-compose stop
$ docker run -it --name gc --rm --volumes-from deploy_registry_1 registry:2.5.0 garbage-collect --dry-run /etc/registry/config.yml
$ docker-compose start