Created
March 20, 2018 20:19
-
-
Save ryan0x44/5cc31109aefd9a6bc7387c6f78980a6c to your computer and use it in GitHub Desktop.
Get Docker Image CMD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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