How you can replace the cmd based on the docker documentation: https://docs.docker.com/reference/builder/#cmd
You can override the CMD command
Dockerfile:
RUN chmod +x /srv/www/bin/* & chmod -R 755 /srv/www/app
RUN pip3 install -r /srv/www/app/pip-requirements.txt
EXPOSE 80
CMD ["/srv/www/bin/gunicorn.sh"]
the docker run command is:
docker run --name test test/test-backend
I tried
docker run --name test test --cmd ["/srv/www/bin/gunicorn.sh"]
docker run --name test test cmd ["/srv/www/bin/gunicorn.sh"]
But the console say this error:
System error: exec: "cmd": executable file not found in $PATH
Docker CMD The CMD instruction is only utilized if there is no argument added to the run command when starting a container. Therefore, if you add an argument to the command, you override the CMD.
To use a prompt override program, follow these steps: Specify any parameters that are to be key parameters on the PARM statement in the command definition source. Write a prompt override program. Specify the name of the prompt override program on the PMTOVRPGM parameter when you create or change the command.
The CMD command specifies the instruction that is to be executed when a Docker container starts.
The ENTRYPOINT or CMD that you specify in your Dockerfile identify the default executable for your image. However, the user has the option to override either of these values at run time.
The right way to do it is deleting cmd ["..."]
docker run --name test test/test-backend /srv/www/bin/gunicorn.sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With