尝试在外部 SSD 上构建 Docker 容器时出错(Ubuntu 22.04.2)

尝试在外部 SSD 上构建 Docker 容器时出错(Ubuntu 22.04.2)

由于我的系统驱动器太小,我正尝试在外部 SSD 上构建 docker 映像。我已按照系统建议安装了 docker,并在文件中停止 docker 后将参数daemon.json设置root-data为我的外部 SSD 上的路径 ( "data-root": "/media/path/to/drive/docker")。但是,在尝试构建 Hello-world 容器时,我收到以下错误:

 docker build -t hello-world .
[+] Building 10.1s (5/80)                                                                                           docker:default
 => [internal] load build definition from Dockerfile                                                                          0.0s
 => => transferring dockerfile: 6.51kB                                                                                        0.0s
 => [internal] load .dockerignore                                                                                             0.0s
 => => transferring context: 2B                                                                                               0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                               2.1s
 => CANCELED [internal] load build context                                                                                    7.9s
 => => transferring context: 929.52MB                                                                                         7.9s
 => ERROR [ 1/78] FROM docker.io/library/ubuntu:20.04@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2fab  7.9s
 => => resolve docker.io/library/ubuntu:20.04@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba         0.0s
 => => sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba 1.13kB / 1.13kB                                0.0s
 => => sha256:3246518d9735254519e1b2ff35f95686e4a5011c90c85344c1f38df7bae9dd37 424B / 424B                                    0.0s
 => => sha256:6df89402372646d400cf092016c28066391a26f5d46c00b1153e75003465484d 2.30kB / 2.30kB                                0.0s
 => => sha256:edaedc954fb53f42a7754a6e2d1b57f091bc9b11063bc445c2e325ea448f8f68 27.51MB / 27.51MB                              5.2s
 => => extracting sha256:edaedc954fb53f42a7754a6e2d1b57f091bc9b11063bc445c2e325ea448f8f68                                     2.0s
------
 > [ 1/78] FROM docker.io/library/ubuntu:20.04@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba:
------
Dockerfile:2
--------------------
   1 |     #Download base image ubuntu
   2 | >>> FROM ubuntu:20.04
   3 |     
   4 |     ENV DEBIAN_FRONTEND noninteractive
--------------------
ERROR: failed to solve: failed to register layer: open /var/lib/dpkg/info/gcc-10-base:amd64.list: invalid argument

gcc-10-base:amd64.list文件存在于我的系统驱动器上,当在 中hello-world不设置 的情况下构建时,它会正常构建和运行。我发现root-datadaemon.json问题并按照建议操作,但apt-file命令没有返回任何内容。有人知道如何解决这个问题吗?非常感谢!

docker --version
Docker version 24.0.5, build ced0996

相关内容