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:

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs