Mesaque Silva Mesaque Silva - 1 month ago 20
Apache Configuration Question

Docker container fails to start

I have this container: 5.6.21-apache from https://hub.docker.com/_/php/

I have installed all I need and my application but I made a mistake doing something wrong with Apache configs.

When I try start my container I get this message:


docker start -ai my-container

[Mon May 02 19:46:33.358838 2016] [core:warn] [pid 1] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon May 02 19:46:33.365305 2016] [core:warn] [pid 1] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
(2)No such file or directory: AH02291: Cannot access directory '/etc/apache2/${APACHE_LOG_DIR}/' for main error log
AH00014: Configuration check failed


How can I solve this? I want drop this configs. I can't just lose this container.

Answer

Since you haven't given enough information to go on, I'm just going to guess. Feel free to add more info to your questions so that it will be easier to help you.

If you search your apache config file and look for APACHE_LOG_DIR, it will probably point to your issue.

This line in the logs is interesting:

Cannot access directory '/etc/apache2/${APACHE_LOG_DIR}/'

Not sure why you would have a log directory under /etc/apache2, but look in that directory to see what you have in there, and set APACHE_LOG_DIR accordingly.

Another thing you can try is to do the following

docker commit (container name or Id) myimage

docker run -it myimage /bin/bash

Then commit changes again to create the fixed image and try to start it up like normal.

docker commit (container Id or name) myimage2

docker run -d -p 80:80 myimage2

Basically save the current container state as an image so you can start it up in a shell and fix the issues. Then once you have fixed the issues you can create a new image and use that to run your container.

I usually avoid this pain by not making changes directly in the containers, I only make changes in my dockerfiles and then when I need to make, I change the dockerfile. If there is an issue, I just need to fix the dockerfile, and the containers don't get in this bad state.

Comments