douyi1966 2017-06-19 08:57
浏览 153
已采纳

在后台Docker容器中运行apache / php / nginx

I am new to docker. I am trying to run a docker container running Apache and PHP or PHP-FPM.

Like that

docker run -p 80:80 --name my-apache-php-app -v "$PWD":/var/www/html php:7.0-apache

And it attaches STDIN/STDOUT to my host machine

docker run -d -p 80:80 --name my-apache-php-app -v "$PWD":/var/www/html php:7.0-apache

Seems to work fine, but I read that

By design, containers started in detached mode exit when the root process used to run the container exits.

Does it mean if I start container from remote ssh connection and then close it, the docker container will stop ?

I am building my custom docker image based on the

library/php/

And I need my image to start automatically in background, not in foreground.

How can I get this behavior ?

  • 写回答

1条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥30 Abaqus做建模的时候网格没办法收敛是为什么?
      • ¥15 车牌识别摄像镜头,httppost,nodejs
      • ¥20 腾讯云托管与本地测试 GET请求获取返回值 完全不同
      • ¥15 C语言有关数组的问题
      • ¥15 edge跟谷歌浏览器的默认搜索引擎无法修改,如何解决?
      • ¥15 access数据库出错
      • ¥100 matlab数学建模习题,求解答
      • ¥15 blender python输出纹理坐标(像素级)与三维坐标的对应关系
      • ¥15 python文件分发
      • ¥15 关于#c语言#的问题:要求:输出格式要界面直观、清晰大方、格式规范