COMMANDs & ARGUMENTS - pracip96/K8s-Learning GitHub Wiki

FROM UBUNTU CMD sleep 5 / CMD ["sleep", "5"]

docker build -t ubuntu-sleeper . docker run ubuntu-sleep

Now, if we want to pass the seconds to sleep during runtime/dynamically, we need to define ENTRYPOINT

FROM UBUNTU ENTRYPOINT ["sleep"], docker run ubuntu-sleep 10, 10 gets appended to the ENTRYPOINT

What if we do not define the sec during the cmd, it takes the cmd param value

We can also override the existing etrypoint with the cmd line docker run --entrypoint sleep2.0 ubuntu-sleeper 10

cmd in pod definition overrides the entrypoint in dockerfile