mirror of
https://github.com/ansible/awx.git
synced 2026-02-01 01:28:09 -03:30
Fix permissions when running dev container as non-root user
I wanted to pass `—user` to `docker-compose` up, but that option doesnt exist. To get around this, I had to record the uid on the host (CURRENT_UID), interpolate the variable in tools/docker-compose.yml, and detect that inside the container. I then piggy-backed on the /etc/passwd hack we use for scenarios with unpredictable uids.
This commit is contained in:
committed by
Ryan Petrello
parent
7df63830ed
commit
a361b5da6e
@@ -1,6 +1,12 @@
|
||||
#!/bin/bash
|
||||
set +x
|
||||
|
||||
if [ `id -u` -ge 500 ] || [ -z "${CURRENT_UID}" ]; then
|
||||
echo "awx:x:`id -u`:`id -g`:,,,:/tmp:/bin/bash" >> /tmp/passwd
|
||||
cat /tmp/passwd > /etc/passwd
|
||||
rm /tmp/passwd
|
||||
fi
|
||||
|
||||
# Wait for the databases to come up
|
||||
ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=postgres port=5432" all
|
||||
ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=memcached port=11211" all
|
||||
|
||||
Reference in New Issue
Block a user