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
[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>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"
                image: jaels/proxy-handler 
                        - 9001:80
                        - ./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        
  • The image you're using is broken. Contact its maintainer. – Michael Hampton Feb 9 '18 at 18:53

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.