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_entrypoint.sh
docker inspect IMAGE --format='{{.Config.Entrypoint}}'

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

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

Example:

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

Check out similar posts by category: Docker