离线装docker
一、下载安装包
docker安装包下载:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-18.09.8-3.el7.x86_64.rpm 依赖包下载: containerd.io:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.2-3.el7.x86_64.rpm docker-ce-cli:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-18.09.8-3.el7.x86_64.rpm container-selinux:https://pkgs.org/download/container-selinux
二、安装
rpm -ivh docker-ce-cli-18.09.8-3.el7.x86_64.rpm rpm -ivh container-selinux-2.107-3.el7.noarch.rpm rpm -ivh containerd.io-1.2.2-3.el7.x86_64.rpm rpm -ivh docker-ce-18.09.8-3.el7.x86_64.rpm
注意:当提示类似policycoreutils-python is needed by container-selinux提示,可以这样解决: 1.主动安装依赖 python install policycoreutils-python 2.强制安装,忽略相关依赖 rpm -ivh ***.rmp --nodeps --force
三、启动docker
# 启动
systemctl start docker
# 查看状态
systemctl status docker
离线装docker-compose
一、docker-compose
Docker Compose是一个单独的开源项目,Docker Compose 可以高效管理和定义多个容器
作用:批量容器编排web服务、redis、mysql、nginx等等多个容器
docker-compose up 一键启动多个容器
Compose:
服务 service,容器、应用。(web、mysql、redis)
项目 Project。一组关联的容器
二、下载
# 这个是官方地址,可能比较慢,推荐使用下面的国内镜像地址 sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose # 国内镜像地址 curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose # 下载完之后可以看下 /usr/local/bin 这个目录有没有 docker-compose 这个文件
可以离线操作:
手动下载,$(uname -s) 及系统名称(Linux),(uname -m)即系统架构(x86_64)
https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)
例:https://github.com/docker/compose/releases/download/1.29.1/docker-compose-Linux-x86_64
上传到服务器/user/bin/里面,注意改名为docker-compose
三、赋权:
# 给docker compose 目录授权 sudo chmod +x /usr/local/bin/docker-compose # 查看一下version,显示有版本号那就说明安装成功了 docker-compose version
结束!