0

Having strange problem when running docker container with docker-compose. It's a docker container with apache+php

If i run it manually - everything ok.

[root@opcis proxy-handler]# docker run -itd -v proxy_html:/var/www/html -p 9001:80 --name=webapp-handler2 jaels/proxy-handler 0b217e295e345056308daedaea441d2b123dd05c7cf29d5c219939f557f8374b [root@opcis proxy-handler]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0b217e295e34 jaels/proxy-handler "/bin/sh -c '/usr/sbi" 6 seconds ago Up 1 seconds 0.0.0.0:9001->80/tcp webapp-handler2 

But if i run it with docker-compose - it fails with "httpd (pid 8) already running"

[root@opcis proxy-handler]# cat docker-compose.yml version: "2" services: proxy-handler: image: jaels/proxy-handler ports: - 9001:80 volumes: - ./webdata:/var/www/html [root@opcis proxy-handler]# docker-compose up Creating proxyhandler_proxy-handler_1 Attaching to proxyhandler_proxy-handler_1 proxy-handler_1 | Passing arguments to httpd using apachectl is no longer supported. proxy-handler_1 | You can only start/stop/restart httpd using this script. proxy-handler_1 | If you want to pass extra arguments to httpd, edit the proxy-handler_1 | /etc/sysconfig/httpd config file. proxy-handler_1 | httpd (pid 8) already running proxyhandler_proxy-handler_1 exited with code 0 [root@opcis proxy-handler]# docker-compose ps Name Command State Ports ------------------------------------------------------------------------------ proxyhandler_proxy-handler_1 /bin/sh -c /usr/sbin/apach ... Exit 0 
1
  • The image you're using is broken. Contact its maintainer. Commented Feb 9, 2018 at 18:53

1 Answer 1

0

See the Dockerfile and run-apache.sh script in this repository. In short, if the httpd process thinks it's already running, then it won't start again. Adding a startup script to the Dockerfile that removes that pid file allows httpd to start.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.