Convert Dockerfile to Kubernetes yaml

4/16/2019

I have 2 line code in Dockerfile like below:

ENTRYPOINT ["/dockerstartup/dockerstartup.sh"]
CMD ["--wait"]

Below is my code converted in Kubernetes yaml:

command: ["/dockerstartup/dockerstartup.sh"]
args: ["--wait"]

Is it correct? Suggestion please.

-- The Night Hunter
dockerfile
kubernetes

2 Answers

4/16/2019

As per Define a Command and Arguments for a Container docs:

The command and arguments that you define in the configuration file override the default command and arguments provided by the container image.

This table summarizes the field names used by Docker and Kubernetes:

| Docker field name | K8s field name |
|------------------:|:--------------:|
|    ENTRYPOINT     |     command    |
|       CMD         |      args      |

So, for your example you should use the following:

Docker:

ENTRYPOINT ["/dockerstartup/dockerstartup.sh"]
CMD ["--wait"]

Kubernetes:

command: ["/dockerstartup/vnc_startup.sh"]
args: ["--wait"]
-- Eduardo Baitello
Source: StackOverflow

4/16/2019

The solution is the code below:

command: ["/dockerstartup/dockerstartup.sh"]
args: ["--wait"]

I missed some the file in script dockerstartup.sh, so I got the error.

-- The Night Hunter
Source: StackOverflow