Docker 运行不起作用,即使它可以拉取镜像并且 docker 正在运行

问题描述 投票:0回答:1

这是我的电脑配置。

pegasus@pegasus:~$ uname -a
Linux pegasus 6.8.0-36-generic #36-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 10 10:49:14 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
pegasus@pegasus:~$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

我已经按照这里提到的方式设置了我的docker。 来自守护进程的错误响应:获取“https://registry-1.docker.io/v2/”:proxyconnect tcp:拨打tcp:在8.8.8.8:53上查找proxy.example.com:没有这样的主机

但是目前在执行 sudo apt update 之后,我面临着即使在拉取之后也无法运行大多数 docker 镜像的问题。

pegasus@pegasus:~$ docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
ubuntu        22.04     8a3cdc4d1ad3   9 days ago      77.9MB
hello-world   latest    d2c94e258dcb   14 months ago   13.3kB
pegasus@pegasus:~$ docker run ubuntu:22.04
pegasus@pegasus:~$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
pegasus@pegasus:~$ systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-07-07 10:40:21 +06; 7min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 3589 (dockerd)
      Tasks: 16
     Memory: 112.9M (peak: 115.2M)
        CPU: 695ms
     CGroup: /system.slice/docker.service
             └─3589 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

জুলাই 07 10:40:20 pegasus systemd[1]: Starting docker.service - Docker Application Container Engine...
জুলাই 07 10:40:20 pegasus dockerd[3589]: time="2024-07-07T10:40:20.790924612+06:00" level=info msg="Starting up"
জুলাই 07 10:40:20 pegasus dockerd[3589]: time="2024-07-07T10:40:20.873556063+06:00" level=info msg="[graphdriver] using prior storage driver: overlay2"
জুলাই 07 10:40:20 pegasus dockerd[3589]: time="2024-07-07T10:40:20.875291689+06:00" level=info msg="Loading containers: start."
জুলাই 07 10:40:21 pegasus dockerd[3589]: time="2024-07-07T10:40:21.049643248+06:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip>
জুলাই 07 10:40:21 pegasus dockerd[3589]: time="2024-07-07T10:40:21.139310021+06:00" level=info msg="Loading containers: done."
জুলাই 07 10:40:21 pegasus dockerd[3589]: time="2024-07-07T10:40:21.159863331+06:00" level=info msg="Docker daemon" commit=c8af8eb containerd-snapshotter=false storage-driver=overlay2 version>
জুলাই 07 10:40:21 pegasus dockerd[3589]: time="2024-07-07T10:40:21.160313458+06:00" level=info msg="Daemon has completed initialization"
জুলাই 07 10:40:21 pegasus dockerd[3589]: time="2024-07-07T10:40:21.216982812+06:00" level=info msg="API listen on /run/docker.sock"
জুলাই 07 10:40:21 pegasus systemd[1]: Started docker.service - Docker Application Container Engine.

我该如何修复它?

docker ubuntu docker-machine docker-run docker-pull
1个回答
0
投票

docker run ubuntu:22.04
不会做任何事情。它启动一个 shell,发现没有 TTY 连接并终止。所以这正如预期的那样。

docker run -it ubuntu:22.04

然后你应该进入容器中的外壳。

docker ps
不显示任何内容的原因是它只显示正在运行的容器,而您没有任何容器。我你愿意

docker ps -a

它还会显示已终止的容器,您应该会看到 Ubuntu 容器处于退出状态。

© www.soinside.com 2019 - 2024. All rights reserved.