How can I determine ENTRYPOINT & CMD are on an image?

A simple method to determine the values of these two instructions is to run

docker inspect <image id>

for example, the CMD on the ubuntu:latest image is /bin/bash:

$ docker inspect ubuntu
[{
    "Architecture": "amd64",
    "Author": "",
    "Comment": "",
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "/bin/bash"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": null,
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "ExposedPorts": null,
        "Hostname": "e7128b67d9e7",
        "Image": "9fec74352904baf5ab5237caa39a84b0af5c593dc7cc08839e2ba65193024507",
        "MacAddress": "",
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkDisabled": false,
        "OnBuild": [],
        "OpenStdin": false,
        "PortSpecs": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": ""
    },
    "Container": "97ed9ba2eafbeff577a82c7314bf60836e4c340f3d22fdcdf670523ab01eea13",
    "ContainerConfig": {
... # You can ignore the container config
}
]
4 Likes

Try this :

docker inspect -f '{{.Config.Entrypoint}}' <image id>
1 Like