命令不携带 docker 图片
Command doesn't carry over docker image
我正在通过我的第一个 docker 教程,由于某些原因,当我创建 docker 图像时,最后一个命令没有通过那里。
Dockerfile
FROM openjdk:11 as build
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
CMD ["java", "Application.java"]
日志
nikolaev@C6151 forDocker % docker build -t my-hello-world .
[+] Building 2.8s (9/9) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 172B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/openjdk:11 2.6s
=> [1/4] FROM docker.io/library/openjdk:11@sha256:84539d4caf6f51c850978ee138458560f84c12e647ad78b8fd9f24854b27da1d 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 647B 0.0s
=> CACHED [2/4] RUN mkdir -p /usr/src/app 0.0s
=> CACHED [3/4] WORKDIR /usr/src/app 0.0s
=> [4/4] COPY . /usr/src/app 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:985e3ae026805c21d7fadac22c9cda10f2e0041d67a706278858baa79dce09e6 0.0s
=> => naming to docker.io/library/my-hello-world
CMD 命令在生成的图像中。它只是没有显示在日志中,因为它没有创建层。如果你 运行 你的图像你会看到它执行 java Application.java
我正在通过我的第一个 docker 教程,由于某些原因,当我创建 docker 图像时,最后一个命令没有通过那里。
Dockerfile
FROM openjdk:11 as build
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
CMD ["java", "Application.java"]
日志
nikolaev@C6151 forDocker % docker build -t my-hello-world .
[+] Building 2.8s (9/9) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 172B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/openjdk:11 2.6s
=> [1/4] FROM docker.io/library/openjdk:11@sha256:84539d4caf6f51c850978ee138458560f84c12e647ad78b8fd9f24854b27da1d 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 647B 0.0s
=> CACHED [2/4] RUN mkdir -p /usr/src/app 0.0s
=> CACHED [3/4] WORKDIR /usr/src/app 0.0s
=> [4/4] COPY . /usr/src/app 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:985e3ae026805c21d7fadac22c9cda10f2e0041d67a706278858baa79dce09e6 0.0s
=> => naming to docker.io/library/my-hello-world
CMD 命令在生成的图像中。它只是没有显示在日志中,因为它没有创建层。如果你 运行 你的图像你会看到它执行 java Application.java