Specifying a command

Providing “command” overrides the ENTRYPOINT and CMD of a container image, similar to the CLI docker run --entrypoint flag.

The first item in command is executed as the entrypoint, and subsequent items are provided as arguments.

Note that if a command is specified, any ENTRYPOINT and CMD set in the dockerfile are overridden. If needed, command can be used to add additional arguments to a container, by including the existing CMD or ENTRYPOINT of the image.

As an example, running docker run --entrypoint /bin/test mycontainer:latest arg1 arg2 arg3 would correspond to the salad command of

[
      "/bin/test",
      "arg1",
      "arg2",
      "arg3"
]

🚧

Caution

Specifying a command overrides the CMD and ENTRYPOINT from your dockerfile. This should only be used if you want to override what is already in your dockerfile.

This is not synonymous with docker run.