I’m trying to use docker-compose to bring up a container. As an ENTRYPOINT, that I have written a simple bash script which is inside the container. But whenwhenever I try to bring up the container in any of the below ways:
- docker-compose up
- docker-compose up foo
it doesn’t complete. i.e., trying to attach to the running container, fails with:
Error response from daemon: Container xyz is restarting, wait until the container is running.
I tried playing around with putting commands in the background. That didn’t work.
my-script.sh
cmd1 &
cmd2 &&
...
cmdn &
I also tried i) with and without entrypoint: /bin/sh /usr/local/bin/my-script.sh and ii) with and without the tty: true option. No dice.
docker-compose.yml
version: '2'
services:
foo:
build:
context: .
dockerfile: Dockerfile.foo
...
tty: true
entrypoint: /bin/sh /usr/local/bin/my-script.sh
I have also tried a manual docker build / run cycle. And (without launching /bin/sh in the ENTRYPOINT ) the run just exits.
$ docker build ... .
$ docker run -it ...
... shell echos commands here, then exits
$
Can anyone help me with this?
Thanks.