# Switching users during "CMD"

**URL:** <https://forums.docker.com/t/switching-users-during-cmd/6655>\
**Category:** General\
**Tags:** docker\
**Created:** [February 24, 2016, 9:04pm UTC](https://forums.docker.com/t/switching-users-during-cmd/6655 "2016-02-24T21:04:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tinysponsor](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@tinysponsor](https://forums.docker.com/u/tinysponsor)\
**Post date:** [February 24, 2016, 9:04pm UTC](https://forums.docker.com/t/switching-users-during-cmd/6655/1 "2016-02-24T21:04:57Z")

</div>

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 `container_start.sh` 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 [https://docs.docker.com/engine/userguide/eng-image/dockerfile\_best-practices/](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/). So how can I actually switch between my web user and root during CMD?

Thanks
