我做了 docker 构建,然后 docker 拉取但失败了,为什么?

I did a docker build, then docker pull but failed, why?

我对构建自己的 Docker 图像还很陌生,所以我想了解我错过了哪一步。

  1. docker build -t cirrus-bluecost-ssc-file-generator ./docker-container/
[+] Building 4.1s (15/15) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 643B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/openjdk:8-jre-alpine                                            1.6s
 => [auth] library/openjdk:pull token for registry-1.docker.io                                                     0.0s
 => [1/9] FROM docker.io/library/openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51  0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 536B                                                                                  0.0s
 => CACHED [2/9] RUN apk update                                                                                    0.0s
 => CACHED [3/9] RUN apk upgrade                                                                                   0.0s
 => CACHED [4/9] RUN apk add busybox-extras                                                                        0.0s
 => [5/9] COPY . /                                                                                                 0.1s
 => [6/9] RUN chmod a+rx cirrus-bluecost-ssc-file-generator/bin/*.sh                                               0.3s
 => [7/9] RUN keytool -importcert -keypass changeit -file ./cirrus-bluecost-ssc-file-generator/bin/IBM_Internal_C  0.7s
 => [8/9] RUN chmod 777 /cirrus-bluecost-ssc-file-generator/bin/start-app.sh                                       0.3s
 => [9/9] RUN chown -R 1001 /cirrus-bluecost-ssc-file-generator/ && chmod -R 777 cirrus-bluecost-ssc-file-generat  0.5s
 => exporting to image                                                                                             0.3s
 => => exporting layers                                                                                            0.3s
 => => writing image sha256:3578356e5d276a52cce292502559897f7f58243078c0e7b37cb034253bb4a83e                       0.0s
 => => naming to docker.io/library/cirrus-bluecost-ssc-file-generator                                              0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

它显然成功了,构建了一个图像并将其放在某个地方

假设接近对面,试过

  1. docker 拉 cirrus-bluecost-ssc-file-generator。得到
Using default tag: latest
Error response from daemon: pull access denied for cirrus-bluecost-ssc-file-generator, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

使用您尝试将映像推送到的容器注册表的路径标记您的映像:

docker tag cirrus-bluecost-ssc-file-generator <container-registry-path>/cirrus-bluecost-ssc-file-generator:latest

将镜像推送到容器注册表:

docker push <container-registry-path>/cirrus-bluecost-ssc-file-generator:latest

现在您可以使用以下命令拉取镜像:

docker pull <container-registry-path>/cirrus-bluecost-ssc-file-generator:latest