Alexander
Alexander

Reputation: 2898

Docker - determining the actual default command for an image: what '/bin/sh -c #(nop) ENTRYPOINT ["xyz"]' mean?

I am trying to figure out the exact command to be executed by default when I run the image as I know that it runs java and I'd like to add memory restrictions to this java command.

Both docker inspect <image> and docker history <image> show the following command for the topmost layer: /bin/sh -c #(nop) ENTRYPOINT ["./bin/run.sh"].

I've seen this answer and I understand from it that everything after '#' is ignored.
Does it mean I should skip this layer and look for the first one without #(nop)?
It does not make much sense for me as this is the only command I could find in docker inspect output.

So, what is the actual command here?

Upvotes: 2

Views: 2140

Answers (2)

BMitch
BMitch

Reputation: 264721

The docker history command provides details about how the image was created, and what actions were performed for each layer of the image. The commented line in the history is in fact a "nop", where nothing was run to create that layer, and in fact you won't see a filesystem layer for that step. Instead, steps like ENTRYPOINT, CMD, ENV, LABEL, etc, modify the metadata associated with an image that you can see in the docker image inspect command.

For more details on how ENTRYPOINT and CMD are related and interact, see the Dockerfile documentation.

Upvotes: 4

Alexander
Alexander

Reputation: 2898

Found through experiments that the command is indeed "./bin/run.sh", it is just specified as ENTRYPOINT and not CMD in the Dockerfile.

Upvotes: 0

Related Questions