I'm writing a Dockerfile for an image that, when run, performs the following two things in order:
- Start up a daemon as root
- Start up an interactive shell as a non-root user
The problem is that ENTRYPOINT
can only be run as a single user (whichever USER
is set last before ENTRYPOINT
in the Dockerfile). In this case, the ENTRYPOINT
can only run as either root or the non-root user.
I can't put CMD
commands before ENTRYPOINT
, because they just get overridden by ENTRYPOINT
.
How can I accomplish what I need?