Cluster Architecture and Installation

What is the difference between CMD and ENTRYPOINT in Dockerfile

CMD ⇒ arguments passed to the image will replace the CMD in the Dockerfile

ENTRYPOINT ⇒ will append the argument passed to the image in the Dockerfile

you can use both to create default behavior plus take cmd passed to the file for example

# Dockerfile - tag is ubuntue-sleeper
FROM Ubuntu

ENTRYPOINT ["sleep"]

CMD ["5"]

---------
$ docker run ubuntue-sleeper # this will sleep 5 seconds
$ docker run ubuntue-sleeper 10 # this will sleep for 10 seconds

if you want to override entrypoint while running the commands you can use the --entrypoint argument

Pod Arguments & Commands

in pod definition files there are arguments and cmd that you can pass to the pod

those corresponds to entrypoint and cmd in the docker file so taking this docker file

# Dockerfile - tag is ubuntue-sleeper
FROM Ubuntu

ENTRYPOINT ["sleep"]

CMD ["5"]

the pod definition file can be like this

# pod.yaml

apiVersion: 1
kind: Pod
metadata:
	name: ubuntu-sleeper-pod
spec:
	container:
		- name: ubuntu-sleeper
			image: user/ubuntue-sleeper
			command: ["sleep2.0"]
			args: ["10"]

this will overall command from the default sleep 5 to be sleep2.0 10

Multi-Container pods