简体   繁体   中英

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.

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.

In my case after rebooting computer (or sleeping/restarting system) I have a problem with starting a container. Before run start I use docker exec command. Example:

docker exec -ti CONTAINER_NAME /bin/bash

(Have a message that container is not running and then)

docker start CONTAINER_NAME

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