VeeBee
VeeBee

Reputation: 847

DOCKER: Running shell script inside container hangs

My dockerfile looks like this currently:

FROM firespring/apache2-php

WORKDIR /var/www/spaceship
COPY . .

EXPOSE 8000

CMD ["bin/server.sh"]

But when I try to run it it with:

$ docker run -p 1234:8000 spaceship

it hangs.

I tried verifying if my base image was not compatible with it:

$ docker run --rm -it --entrypoint=/bin/bash spaceship

root@fa09751cd081:/var/www/spaceship# ls

Dockerfile  README.md  application  bin  composer.json  composer.lock  favicon.ico  public  vendor

root@fa09751cd081:/var/www/spaceship# bin/server.sh

PHP 5.5.9-1ubuntu4.24 Development Server started at Sat Apr  6 02:51:44 2019
Listening on http://127.0.0.1:8000
Document root is /var/www/spaceship/public
Press Ctrl-C to quit.

but apparently it works inside the container locally.

So I guess my question is how do i write the proper dockerfile for this?

Upvotes: 0

Views: 1249

Answers (1)

Mihai
Mihai

Reputation: 10757

Can you try and add "-d" to your docker run command:

docker run -d -p 1234:8000 spaceship

Upvotes: 1

Related Questions