13

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)

26

It turns out the answer is to use the array form of ENTRYPOINT (and/or CMD) in order for appending from command line to work

with:

ENTRYPOINT ["uwsgi", "--ini", "/home/docker/app/uwsgi_app.ini"]

then:

$ docker run -itP uwsgi_app:0.2 --uid=docker
...
user docker not found.

(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 :)

  • How do I change the array argument on command line to docker run --entrypoint ... IMAGE ? – eel ghEEz May 31 '16 at 20:55
  • I don't think there is an array form for the run command docs.docker.com/engine/reference/run/… maybe you have to quote it eg docker run --entrypoint "uwsgi --ini /home/docker/app/uwsgi_app.ini" <image> – Anentropic Jun 3 '16 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.