Is there any way to start an interactive shell in a container using Docker Compose only? I've tried something like this, in my docker-compose.yml:
myapp:
image: alpine:latest
entrypoint: /bin/sh
When I start this container using docker-compose up it's exited immediately. Are there any flags I can add to the entrypoint
command, or as an additional option to myapp
, to start an interactive shell?
I know there are native docker command options to achieve this, just curious if it's possible using only Docker Compose, too.
/bin/sh
entrypoint in your compose file, what should it do? – Xiongbing Jindocker-compose run myapp
? – ivobadocker-compose run myapp
is that it won't expose the ports. So you have to usedocker-compose run --service-ports myapp
but still its not very convenient. – The Fool