Linux 离线装 docker & docker-compose
离线装 docker
官方文档
https://docs.docker.com/install/linux/docker-ce/binaries/
下载地址
https://download.docker.com/linux/static/stable/x86_64/
step 1:下载离线安装包并解压到相应目录
tar xzvf /path/to/<FILE>.tar.gz
sudo cp docker/* /usr/bin/
step 2: 添加 docker.service 文件
[root@localhost system]# vi /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker
[Service]
Restart=always
RestartSec=3
ExecStart=/usr/bin/dockerd
[Install]
WantedBy=multi-user.target
step 3: 启动 docker 服务
systemctl start docker
systemctl enable docker
离线装 docker-compose
官方文档:https://docs.docker.com/compose/install/
下载地址:https://github.com/docker/compose/releases
cp docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
chmod 755 /usr/local/bin/docker-compose
docker-compose --version
离线安装docker在step 3之后启动不了docker,就需要添加如下两条
1、chmod +x /usr/lib/systemd/system/docker.service
2、systemctl daemon-reload
再次启动docker就可以了