ubuntu 18.04离线安装docker
参考链接: https://www.jianshu.com/p/42d1c9fb538c
1、系统环境
LSB是Linux Standard Base的缩写,lsb_release命令用来显示LSB和特定版本的相关信息。
root@ubuntu:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic root@ubuntu:~$
2、下载相关的包
包名
libltdl7_2.4.6-2_amd64.deb docker-ce-cli_18.09.6~3-0~ubuntu-bionic_amd64.deb containerd.io_1.2.5-1_amd64.deb docker-ce_18.09.6~3-0~ubuntu-bionic_amd64.deb
对应下载链接
http://archive.ubuntu.com/ubuntu/pool/main/libt/libtool/libltdl7_2.4.6-2_amd64.deb https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce-cli_18.09.6~3-0~ubuntu-bionic_amd64.deb https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/containerd.io_1.2.5-1_amd64.deb https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce_18.09.6~3-0~ubuntu-bionic_amd64.deb
下载保存
3、顺序安装相关的包
sudo dpkg -i libltdl7_2.4.6-2_amd64.deb sudo dpkg -i docker-ce-cli_18.09.6~3-0~ubuntu-bionic_amd64.deb sudo dpkg -i containerd.io_1.2.5-1_amd64.deb sudo dpkg -i docker-ce_18.09.6~3-0~ubuntu-bionic_amd64.deb
4、验证是否成功
docker -v
5、docker ps 或 docker images遇到问题permission denied
报错信息
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/json: dial unix /var/run/docker.sock: connect: permission denied
解决方案:
(1)添加docker组
(2)添加用户到docker组
(3)切换用户
sudo groupadd docker sudo usermod -aG docker ${USER}
su ${USER}
备注:
①${USER}表示用户名
②参考链接: https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket