DEV Community

Nelson Figueroa
Nelson Figueroa

Posted on • Originally published at nelson.cloud on

How to Determine the Entrypoint for a Docker Image

You can use docker inspect to determine the entrypoint of a docker image.

The command looks like this:

docker inspect --type=image --format='{{json .Config.Entrypoint}}' <image-name> 
Enter fullscreen mode Exit fullscreen mode

And here’s a real-world example (assuming you have the hashicorp/terraform image downloaded):

docker inspect --type=image --format='{{json .Config.Entrypoint}}' hashicorp/terraform

["/bin/terraform"]
Enter fullscreen mode Exit fullscreen mode

There are some examples on the official docs but none of the examples covered my use cases, so here are some additional useful docker inspect examples using the busybox image.

List environment variables:

docker inspect --type=image --format='{{json .Config.Env}}' busybox

["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"]
Enter fullscreen mode Exit fullscreen mode

List the CMD:

docker inspect --type=image --format='{{json .Config.Cmd}}' busybox

["sh"]
Enter fullscreen mode Exit fullscreen mode

Print out the architecture:

docker inspect --type=image --format='{{json .Architecture}}' busybox

"amd64"
Enter fullscreen mode Exit fullscreen mode

The docker inspect command can also be used to inspect other docker resources too, not just images. Check out the documentation for more information.

References:

Top comments (0)