简体   繁体   中英

DOCKER: Running shell script inside container hangs

  • I am currently trying to dockerize a codeigniter application cloned from here .
  • I used a base lamp stack image from docker hub found here

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?

您可以尝试在docker run命令中添加“-d”:

docker run -d -p 1234:8000 spaceship

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM