Skip to content

Instantly share code, notes, and snippets.

@ryan0x44
Created March 20, 2018 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryan0x44/5cc31109aefd9a6bc7387c6f78980a6c to your computer and use it in GitHub Desktop.
Save ryan0x44/5cc31109aefd9a6bc7387c6f78980a6c to your computer and use it in GitHub Desktop.
Get Docker Image CMD
#!/bin/bash -e
# Using the "hello-world" image as an example
# https://github.com/docker-library/hello-world/blob/c83a065a24e94e635ddd518c2a3cffc91accf30d/amd64/hello-world/Dockerfile#L3
# `CMD ["/hello"]`
docker pull hello-world
docker inspect -f "{{.Config.Cmd}}" hello-world | cut -f2 -d "[" | cut -f1 -d "]"
# produces: `/hello`
# Note: you might also expect to see `/bin/sh -c exec` as a prefix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment