8RUN apt-get update -y && apt-get install -y google-cloud-sdk && apt-get autoremove -y
9RUN apt-get clean -y
10
11CMD gcloud info
When using the plain text version of passing arguments, signals from the OS are not correctly passed to the executables, which is in the majority of the cases what you would expect.
These points shall always be taken care of:
CMD
should almost always be used in the form of CMD [“executable”, “param1”, “param2”…]
Read more about these best practices here.
FROM debian:buster
ENTRYPOINT s3cmd
FROM debian:buster
CMD my-service server
FROM debian:buster
CMD ["my-service", "server"]
Note
CMD
does not process $ENVIRONMENT_VARIABLE
s, that’s a side-effect of using sh -c
as the default entry-point. Using the JSON notation means that you have to figure out how to handle environment variables yourself."
) instead of single quote ('
). See https://docs.docker.com/v17.09/engine/reference/builder/#cmd for more info.