Docker Community Forums

Share and learn in the Docker community.

Switching users during "CMD"


(Tinysponsor) #1

Hi everyone,

I’m fairly new to docker so my question may sound stupid. I am trying to deploy a django application using docker. There are commands like migrate or collectstatic that needed to be executed by my app user (it’s a new user I create on my Dockerfile). So I have a file called that I call using CMD. Now when all the commands are executed, I need to call supervisord -n as root. The issue is using sudo should be avoided according to So how can I actually switch between my web user and root during CMD?