I have a Dockerfile with:
ENTRYPOINT ["uwsgi", "--ini /home/docker/app/uwsgi_app.ini"]
(no CMD
)
When I run that uwsgi rightly complains:
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Now, I thought that I can append arguments to the entrypoint via docker run
like so:
$ docker run -itP uwsgi_app:0.1 --uid=docker
However uwsgi still complains with the same error, it seems the arg has not been appended.
If I override the entrypoint then arg gets added:
$ docker run -itP --entrypoint bash uwsgi_app:0.1 --uid=docker
bash: --uid=docker: invalid option
... I wondered if it was uwsgi's --ini
option ignoring other args, but it's not that:
$ docker run -itP --entrypoint bash uwsgi_app:0.1
[ root@88941de25b1f:/home/docker ]$ uwsgi --ini /home/docker/app/uwsgi_app.ini --uid=docker
user docker not found.
(okay, an error, but shows the arg was accepted)
It turns out the answer is to use the array form of
ENTRYPOINT
(and/orCMD
) in order for appending from command line to workwith:
then:
(okay, an error, but shows the arg was accepted)
This behaviour is actually described in the docs:
https://docs.docker.com/reference/builder/#entrypoint
...I missed that when skim reading them though :)