centos7安装docker和docker compose快速指引
星期三, 2021-12-01 | Author: Lee | JAVA-and-J2EE, linux | 738 views
1. 安装之前,先清除之前安装的旧版本docker
sudo 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. 使用 repository 安装 docker ce
##安装基础依赖包 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 http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo ## 如果想安装指定版本的docker-ce,可以先用命令查看版本号 sudo yum list docker-ce --showduplicates | sort -r ## 直接运行会默认安装最新版 sudo yum install docker-ce ## 安装指定版本,例如:yum install docker-ce-20.10.11 sudo yum install docker-ce-<VERSION STRING> ###创建配置信息 sudo mkdir /etc/docker sudo cat > /etc/docker/daemon.json <<EOF { "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2", "storage-opts": [ "overlay2.override_kernel_check=true" ] } EOF |
3. 安装 docker-compose不使用pip安装,直接用编译好的
curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose |
上面安装的是稳定版本1.29.2的 docker-compose,可以到github上找最新版 https://github.com/docker/compose/releases
配置docker-compose命令关联
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose |
安装成功后启动docker并设置开机启动
sudo systemctl start docker.service ###或者 systemctl start docker systemctl enable docker |
4. 卸载 docker-ce
sudo yum remove docker-ce sudo rm -rf /var/lib/docker |
5. 卸载 docker-compse
sudo rm /usr/local/bin/docker-compose |
文章作者: Lee
本文地址: https://www.pomelolee.com/2244.html
除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址
No comments yet.
Leave a comment
Search
相关文章
热门文章
最新文章
文章分类
- ajax (10)
- algorithm-learn (3)
- Android (6)
- as (3)
- computer (85)
- Database (30)
- disucz (4)
- enterprise (1)
- erlang (2)
- flash (5)
- golang (3)
- html5 (18)
- ios (4)
- JAVA-and-J2EE (186)
- linux (143)
- mac (10)
- movie-music (11)
- pagemaker (36)
- php (50)
- spring-boot (2)
- Synology群晖 (2)
- Uncategorized (6)
- unity (1)
- webgame (15)
- wordpress (33)
- work-other (2)
- 低代码 (1)
- 体味生活 (40)
- 前端 (21)
- 大数据 (8)
- 游戏开发 (9)
- 爱上海 (19)
- 读书 (4)
- 软件 (3)