Override ENTRYPOINT and CMD
If you are overriding the Dockerfile ENTRYPOINT
or CMD
, it only affects the image but not the deployment in Kubernetes. If a deployment using this image defines the command
or args
options, they will take precedence over the overrides you define for the image.
entrypoint
The entrypoint
option expects an array of strings which tells DevSpace to override the ENTRYPOINT
defined in the Dockerfile
during the image building process.
If you are overriding the ENTRYPOINT
, it is often useful to also override the CMD
statement. If you want to define entrypoint: ...
for an image and you do not want the CMD
statement from the Dockerfile, add cmd: []
to the image configuration in your devspace.yaml
.
Default Value For entrypoint
entrypoint: []
Example: Override ENTRYPOINT For Image
images:
backend:
image: john/appbackend
frontend:
image: john/appfrontend
entrypoint:
- npm
- run
- dev
Explanation:
- The first image
backend
will be built using the regularENTRYPOINT
(e.g.[npm, start]
) defined by the Dockerfile located in./Dockerfile
- The second image
frontend
will be built using the same Dockerfile but instead of the originalENTRYPOINT
, DevSpace would use the[npm, run, dev]
as value forENTRYPOINT
cmd
The cmd
option expects an array of strings which tells DevSpace to override the CMD
defined in the Dockerfile
during the image building process.
CMD
generally defines the arguments for ENTRYPOINT
.
Default Value For cmd
cmd: []
Example: Override CMD For Image
images:
backend:
image: john/appbackend
frontend:
image: john/appfrontend
cmd:
- run
- dev
Explanation:
- The first image
backend
will be built using the regularCMD
(e.g.[start]
) forENTRYPOINT
(e.g.[npm]
) defined by the Dockerfile located in./Dockerfile
- The second image
frontend
will be built using the same Dockerfile but instead of the originalCMD
, DevSpace would use the[run, dev]
as value forCMD