How to override parameters in the docker?

3/14/2019

I have extension.yaml with

 args:["key1","newValue"]

in my dockerfile

ENTRYPOINT  [ "/path/execution"]
CMD["-key1","value1","-key2","value2","-key3","value3]

When I will run the container does the keys : key2 and key3 will be saved or it will be deleted ?

also Can I move execution from the ENTRYPOINT to the first parameter in the CMD

-- user1365697
docker
dockerfile
kubernetes

1 Answer

3/14/2019

According to the k8s docs:

The command and arguments that you define in the configuration file override the default command and arguments provided by the container image. If you define args, but do not define a command, the default command is used with your new arguments.

For your docker example the entrypoint field corresponds to k8s command. This is the relation:

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

If you supply only args for a Container, the default Entrypoint defined in the Docker image is run with the args that you supplied.

So, for your example you will end with the following command:
/path/execution key1 newvalue

-- Eduardo Baitello
Source: StackOverflow