I can ssh onto a machine and run the following script
echo testing
docker-compose exec -T meteor php artisan down
echo done
which returns
testing
Application is now in maintenance mode.
done
However it I try and run that command over ssh it exits immediately after the docker-compose call.
ssh [email protected] << EOF
echo testing
docker-compose exec -T meteor php artisan down
echo done
EOF
gives
testing
Application is now in maintenance mode.
ie done is missing
I can get it to continue by adding && after the docker-compose command but i've got a long script and it makes it ugly and error prone if I have to explicity state this.
Any idea why this is happening and what I can change to fix it.
Update
I removed the -T from docker-compose and the script ran to completion however it gave the message the input device is not a TTY. It appears it can't allocate the interactive console. After a bit more googling I found that I can call
export COMPOSE_INTERACTIVE_NO_CLI=1
And then it will run to completion without giving error messages.
Thanks all for the help :)
docker-composereturning?&& echo $?executes for a nonzero code, but perhaps the environment is exiting because of what it sees as a failure. Personally, I would throw the whole thing into a script with error checking and logging &c, but if it isn't worth all that to you and you just want to plow ahead, add a||:on the end of thedocker-composecommand to tell it to just shut up and keep going.ssh, so it's possible thatdocker-composeis reading from its standard input, which means it would read theecho doneline before the remote shell that randocker-composegets the chance.