这是我的电脑配置。pegasus@pegasus:~$ uname -aLinux 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/Linuxpegasus@pegasus:~$ cat /e...
这是我的电脑配置。
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:dial tcp:lookup proxy.example.com on 8.8.8.8:53:没有这样的主机
但是目前执行 sudo apt upgrade 之后,我面临的问题是即使在拉取之后也无法运行大多数 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 run ubuntu:22.04
什么都不做。它启动一个 shell,发现没有 TTY 连接并终止。所以这是意料之中的。如果你添加该 -it
选项,它会以交互方式运行它,如下所示:
docker run -it ubuntu:22.04
然后你应该进入容器中的 shell。一旦你退出 shell,容器就会终止。这就是容器的工作方式。它们只在内部进程运行时运行。
的原因 docker ps
是它只显示正在运行的容器,而你没有任何容器。如果你有
docker ps -a
它还将显示已终止的容器,您应该会看到您的 Ubuntu 容器处于退出状态。