Alexandru Circus
Alexandru Circus

Reputation: 5538

Run Docker Entrypoint as root and CMD as non root

I want to start nginx and cron as root user and php-fpm as 1001 user. How can I do that? I thought I must create an entrypoint script where I use su-exec and start nginx and cron as root and set CMD in docker compose that starts php-fpm and also set user 1001 via docker compose.

Upvotes: 0

Views: 1007

Answers (2)

user4093955
user4093955

Reputation:

the solution for this is not to use ENTRYPOINT and CMD to run each service, but to have a script which runs both services, and use that as the entrypoint.

Upvotes: 1

Thamer
Thamer

Reputation: 1954

to achieve that there is a bash script within Docker documentation in this link:

multi-service_container

otherwise, I recommend you to run each service within his own container.

Upvotes: 1

Related Questions