docker
docker copied to clipboard
Docker detach options and others not passed to `docker.sh`
Describe the bug
-d
or --detach
option not passed to docker-compose run
operation. Specifically testing on pelias prepare step OPTS
Steps to Reproduce
bash -x ./docker/pelias prepare interpolation -d
.... Okay, please see output from script: Does docker-compose
invocation have the detach option? Nope.
Well, if you try any other options -- valid compose or invalid options -- do they appear? Nope.
What you see now is that the docker container for prepare
step is in foreground still and not detaching.
Expected behavior
CURRENT:
docker-compose run --rm -T interpolation bash ./docker_build.sh
DESIRED:
docker-compose run --rm --detach -T interpolation bash ./docker_build.sh
... Or any other valid compose options inserted in the right spot.
Environment (please complete the following information):
- docker 19.0x on RHEL
- pelias latest
Additional context
Possible solution that works for me:
export RUN_DETACHED=1
with
cmd/docker.sh
tweaks below:
DETACH_ARG=
if [ "$RUN_DETACHED" = "1" ]; then
DETACH_ARG="--detach"
fi
function compose_run(){ net_init; docker-compose run --rm $DETACH_ARG $@; }
register 'compose' 'run' 'execute a docker-compose run command' compose_run