Reputation: 1178
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?
Upvotes: 2
Views: 1661
Reputation: 1178
Okay, got it (facepalm):
With the docker -d
you're going to start the process INSIDE the container in the background. So my app was already running inside the container, but in the background.
Cheers!
Upvotes: 2