# Running AWX containers as non-root user on docker host

**URL:** <https://forum.ansible.com/t/running-awx-containers-as-non-root-user-on-docker-host/26098>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [November 21, 2017, 5:30pm UTC](https://forum.ansible.com/t/running-awx-containers-as-non-root-user-on-docker-host/26098 "2017-11-21T17:30:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark.anthony.2017.ma](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mark.anthony.2017.ma](https://forum.ansible.com/u/mark.anthony.2017.ma)\
**Post date:** [November 21, 2017, 5:30pm UTC](https://forum.ansible.com/t/running-awx-containers-as-non-root-user-on-docker-host/26098/1 "2017-11-21T17:30:09Z")

</div>

Hi,

How do I run awx\_web and awx\_task containers as non-root user on docker host so that  
they don’t have root privileges on docker host?

I tried to run awx\_web container by passing the below user option in docker run.

–user “$(id -u):$(id -g)”

But it fails when launch\_awx.sh tries to update /etc/passwd.

if [`id -u` -ge 500]; then  
echo “awx:x:`id -u`:`id -g`:,:/var/lib/awx:/bin/bash” \>\> /tmp/passwd  
cat /tmp/passwd \> /etc/passwd  
rm /tmp/passwd  
fi

Commenting the update of /etc/password and running launch\_awx.sh fails as supervisord.log  
doesn’t have write permissions on /var/lib/awx?

ls -lr /var/lib/ | grep awx  
drwxrwxr-x. 1 root root 4096 Nov 20 19:28 awx

Has anyone tried to make awx containers run as non-root user? I’m thinking of playing  
with below options and want to check if anyone has tried and if there are any other options

a. Removing root user in Dockerfile when building

USER root

b. Changing file permissions in the container.

c. Configure user namespaces on docker daemon, but run as root user on container.

Thanks,  
Mark
