I'm creating dynamically docker containers via bash script:
while getopts ":s:d:h" opt; do
case $opt in
s)
for i in $(seq $2 $END);
do
docker run -dit --name=app_client_$i -d app:client
docker exec -d app_client_$i $app_start
done
;;
...
The docker container starts fine, but the docker exec command caused problems. When I try (without the -d):
docker exec app_client_$i $app_start
The application inside the docker container starts fine - but I'm attached to this docker container. I want to start the app inside the docker container in the background, so I use the -d parameter:
docker exec -d app_client_$i $app_start
With that the app doesn't start inside the docker container. What I am missing?
docker logs app_client_$1there is no output.$app_startis a java call with the java interpreter.docker run -itdwhich should be either a daemon or interactive, but not both, anddocker execshould not be with -d, See supervisor, runit, daemontools or s6 you want to launch several processes in a container-iparameter inside the run command and also tried it with the quoting variables like"app_client_$i" "$app_start". Both do not work.