编程开发Docker安装Docker及docker-compose教程
秋夜袭雨安装Docker
安装命令
1 2 3 4 5 6 7
| yum install -y yum-utils yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum makecache fast yum install -y docker-ce systemctl start docker.service systemctl enable docker docker version
|
配置镜像源
速度快,但是版本稍旧
https://docker.mirrors.ustc.edu.cn
速度稍慢,但是版本基本最新
http://hub-mirror.c.163.com
1 2 3 4 5
| vim /etc/docker/daemon.json
{ "registry-mirrors": ["http://hub-mirror.c.163.com"] }
|
重启docker服务
1 2
| systemctl daemon-reload systemctl restart docker
|
自动补全
1
| yum install -y bash-completion
|
安装docker-compose
查看最新版本
=== 查看最新版本 ===
安装命令
1 2 3 4 5 6
| mkdir -p /usr/local/lib/docker/cli-plugins curl -L "https://github.91chi.fun/https://github.com//docker/compose/releases/download/v2.6.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/lib/docker/cli-plugins/docker-compose
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose ln -s /usr/local/lib/docker/cli-plugins/docker-compose /usr/bin/docker-compose docker-compose version
|