15

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)

1 Answer 1

28

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

2
  • 1
    How do I change the array argument on command line to docker run --entrypoint ... IMAGE ?
    – eel ghEEz
    May 31, 2016 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, 2016 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .