Skip to content

Instantly share code, notes, and snippets.

@rmoyano
Created June 14, 2024 05:23
Show Gist options
  • Save rmoyano/0f88b83e0d00091ed65a4f86f4448d87 to your computer and use it in GitHub Desktop.
Save rmoyano/0f88b83e0d00091ed65a4f86f4448d87 to your computer and use it in GitHub Desktop.
Docker notes

Docker notes

Entrypoint and CMD differences

One SO thread.

From Devopscube article:

In a Dockerfile, ENTRYPOINT and CMD are two different instructions that are used to define how a container should run.

ENTRYPOINT is used to specify the main command that should be executed when a container is started using the image. The default ENTRYPOINT command is /bin/sh -c.

CMD, on the other hand, is used to specify the default command and arguments that should be executed when a container is started.

If both ENTRYPOINT and CMD are specified in a Dockerfile, the command specified in CMD will be appended to the ENTRYPOINT command. It acts as an argument for ENTRYPOINT. The resulting command will be executed when the container is started.

user@notebook:~$ curl -I http://www.example.org
HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 126555
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Thu, 23 May 2024 21:14:48 GMT
Etag: "3147526947"
Expires: Thu, 30 May 2024 21:14:48 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECAcc (mid/871F)
X-Cache: HIT
Content-Length: 1256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment