I’ve been banging my head against the wall for two days now on this issue.
Dockerfile:
FROM ubuntu:latest
USER root
... snipped a bunch of setup of the container
ENTRYPOINT ["/bin/bash", "-c", "/docker-entrypoint.sh"]
The container itself is fine
I’ve googled, I’ve read documentation, everything I’ve seen indicates that the entrypoint given should result in the container accepting arguments like the following:
docker-compose run --rm -v /home/mfaine:/home/ansible -e TZ=CST6CDT ansible whoami
and should produce output like:
ansible
However the args list is always empty.
+ echo 'Container args: '
Container args:
+ TZ=CST6CDT
+ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/virtualenv/bin
+ ANSIBLE_CONFIG=/home/ansible/ansible.cfg
+ export TZ PATH ANSIBLE_CONFIG
docker-compose.yml
---
version: '3.7'
services:
ansible:
image: my-image
networks:
- net
secrets:
- my-secrets
user: ${UID:-1001}:${GID:-1001}
networks:
net:
external: true
secrets:
... snipped the secrets configuration
/docker-entrypoint.sh:
#!/bin/bash
set -x
echo "Container args: $@"
TZ=CST6CDT
PATH="$PATH:/virtualenv/bin"
ANSIBLE_CONFIG="/home/ansible/ansible.cfg"
export TZ PATH ANSIBLE_CONFIG
/usr/local/bin/fixuid -q
# I've tried both approaches below
#exec /usr/sbin/gosu ansible:ansible "$@"
exec /usr/sbin/gosu ansible:ansible /wrapper.sh "$@"
I’m going insane, please help.