How to extract the ENTRYPOINT and COMMAND of a Docker container image

You can use docker inspect like this to extract the ENTRYPOINT of a docker image.

docker inspect IMAGE --format='{{.Config.Entrypoint}}'

What’s often also useful is to print it in conjunction with the command:

docker inspect IMAGE --format='ENTRYPOINT: {{.Config.Entrypoint}} CMD: {{.Config.Cmd}}'

Example:

$ docker inspect nginxinc/nginx-s3-gateway:latest --format='{{.Config.Entrypoint}}'
[/docker-entrypoint.sh]
$ docker inspect nginxinc/nginx-s3-gateway:latest --format='ENTRYPOINT: {{.Config.Entrypoint}} CMD: {{.Config.Cmd}}'
ENTRYPOINT: [/docker-entrypoint.sh] CMD: [nginx -g daemon off;]