今天安装docker后安装了一下docker-compose,然后发现docker无法启动了查看一下报错日志
有这么个错误 Failed to start LSB: Create lightweight, portable, self-sufficient containers..
经过查询按以下方法解决
首先输入以下命令
wget -qO- https://get.docker.com/
如果无法访问就挂一个代理,ubuntu有个工具proxychains,下载proxychains后,在这里/etc/proxychains.conf配置代理,将你的代理添加到最后一行
vim /etc/proxychains.conf
然后如果想要使用代理的话就在命令前加上proxychains,如下
proxychains wget -qO- https://get.docker.com/
然后访问完docker这个页面后,会下载一个index.html
使用代理执行这个刚刚下载下来的东西,因为在执行的时候会访问一些网站需要代理
proxychains sh index.html
结果
ProxyChains-3.1 (http://proxychains.sf.net)
# Executing docker install script, commit: 0d6f72e671ba87f7aa4c6991646a1a5b9f9dae84
Warning: the "docker" command appears to already exist on this system.If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.You may press Ctrl+C now to abort this script.
+ sleep 20
+ sh -c apt-get update -qq >/dev/null
|DNS-request| ppa.launchpad.net
|DNS-request| debian.octopuce.fr
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|DNS-request| mirrors.aliyun.com
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|DNS-response| ppa.launchpad.net is 185.125.190.80
|S-chain|-<>-172.24.231.86:7897-<><>-185.125.190.80:80-<><>-OK
|DNS-response| mirrors.aliyun.com is 47.246.24.227
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.227:80-<><>-OK
|DNS-response| debian.octopuce.fr is 91.194.60.112
|S-chain|-<>-172.24.231.86:7897-<><>-91.194.60.112:443-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.227:80-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.227:80-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.227:80-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.227:80-<><>-OK
W: GPG error: https://debian.octopuce.fr/snapshots/sury-php/20220630010404 stretch InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
W: The repository 'https://debian.octopuce.fr/snapshots/sury-php/20220630010404 stretch InRelease' is not signed.
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq ca-certificates curl >/dev/null
+ sh -c install -m 0755 -d /etc/apt/keyrings
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" -o /etc/apt/keyrings/docker.asc
|DNS-request| download.docker.com
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|DNS-response| download.docker.com is 54.230.21.10
|S-chain|-<>-172.24.231.86:7897-<><>-54.230.21.10:443-<><>-OK
+ sh -c chmod a+r /etc/apt/keyrings/docker.asc
+ sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu focal stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
|DNS-request| download.docker.com
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-|DNS-request| ppa.launchpad.net
<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|DNS-request| mirrors.aliyun.com
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|DNS-request| debian.octopuce.fr
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|DNS-response| mirrors.aliyun.com is 47.246.24.226
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.226:80-<><>-OK
|DNS-response| download.docker.com is 54.230.21.56
|S-chain|-<>-172.24.231.86:7897-<><>-54.230.21.56:443-<><>-OK
|DNS-response| debian.octopuce.fr is 91.194.60.112
|S-chain|-<>-172.24.231.86:7897-<><>-91.194.60.112:443-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.226:80-<><>-OK
|DNS-response| ppa.launchpad.net is 185.125.190.80
|S-chain|-<>-172.24.231.86:7897-<><>-185.125.190.80:80-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.226:80-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.226:80-<><>-OK
|S-chain|-<>-172.24.231.86:7897-<><>-47.246.24.226:80-<><>-OK
W: GPG error: https://debian.octopuce.fr/snapshots/sury-php/20220630010404 stretch InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
W: The repository 'https://debian.octopuce.fr/snapshots/sury-php/20220630010404 stretch InRelease' is not signed.
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null
|DNS-request| download.docker.com
|S-chain|-<>-172.24.231.86:7897-<><>-4.2.2.2:53-<><>-OK
|DNS-response| download.docker.com is 54.230.21.60
|S-chain|-<>-172.24.231.86:7897-<><>-54.230.21.60:443-<><>-OK
+ sh -c docker version
Client: Docker Engine - Community
Version: 27.1.2
API version: 1.46
Go version: go1.21.13
Git commit: d01f264
Built: Mon Aug 12 11:51:03 2024
OS/Arch: linux/amd64
Context: defaultServer: Docker Engine - Community
Engine:
Version: 27.1.2
API version: 1.46 (minimum version 1.24)
Go version: go1.21.13
Git commit: f9522e5
Built: Mon Aug 12 11:51:03 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.20
GitCommit: 8fc6bcff51318944179630522a095cc9dbf9f353
runc:
Version: 1.1.13
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0================================================================================
To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:dockerd-rootless-setuptool.sh install
Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.
To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/WARNING: Access to the remote API on a privileged Docker daemon is equivalent
to root access on the host. Refer to the 'Docker daemon attack surface'
documentation for details: https://docs.docker.com/go/attack-surface/================================================================================
然后docker就可以正常使用了