Home > Enterprise >  Command doesn't carry over docker image
Command doesn't carry over docker image

Time:11-27

I'm passing my first docker tutorial, and for some reason, when I create docker image last command don't pass there.

Dockerfile

FROM openjdk:11 as build

RUN mkdir -p /usr/src/app

WORKDIR /usr/src/app

COPY . /usr/src/app

CMD ["java", "Application.java"]

Log

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   

CodePudding user response:

The CMD command is in the generated image. It is just not shown in the log because it doesn't create a layer. If you run your image you will see it executes the java Application.java

  • Related