I’m trying to build a php chess app and wrap it in Docker
container. At first I took my old docker config, but it didn’t work, so I added some stuff on top of it (like copying config apache files into the container and so on). The point is – I copy apache2/ports.conf
into the container which only consists of only one line Listen 80
. But after running the container it shows that there is an error on line 5. And when I look at the content of the file before running,it shows it consists of only 1 line, so I’m confused. In the repo (link below) I have this file.
-> % docker start -a chess_php_1
[Tue Sep 13 18:25:20.097378 2022] [so:warn] [pid 1] AH01574: module access_compat_module is already loaded, skipping
[Tue Sep 13 18:25:20.097542 2022] [so:warn] [pid 1] AH01574: module alias_module is already loaded, skipping
[Tue Sep 13 18:25:20.097582 2022] [so:warn] [pid 1] AH01574: module auth_basic_module is already loaded, skipping
[Tue Sep 13 18:25:20.097626 2022] [so:warn] [pid 1] AH01574: module authn_core_module is already loaded, skipping
[Tue Sep 13 18:25:20.097672 2022] [so:warn] [pid 1] AH01574: module authn_file_module is already loaded, skipping
[Tue Sep 13 18:25:20.097716 2022] [so:warn] [pid 1] AH01574: module authz_core_module is already loaded, skipping
[Tue Sep 13 18:25:20.097757 2022] [so:warn] [pid 1] AH01574: module authz_host_module is already loaded, skipping
[Tue Sep 13 18:25:20.097805 2022] [so:warn] [pid 1] AH01574: module authz_user_module is already loaded, skipping
[Tue Sep 13 18:25:20.097859 2022] [so:warn] [pid 1] AH01574: module autoindex_module is already loaded, skipping
[Tue Sep 13 18:25:20.097909 2022] [so:warn] [pid 1] AH01574: module deflate_module is already loaded, skipping
[Tue Sep 13 18:25:20.097960 2022] [so:warn] [pid 1] AH01574: module dir_module is already loaded, skipping
[Tue Sep 13 18:25:20.098011 2022] [so:warn] [pid 1] AH01574: module env_module is already loaded, skipping
[Tue Sep 13 18:25:20.098056 2022] [so:warn] [pid 1] AH01574: module filter_module is already loaded, skipping
[Tue Sep 13 18:25:20.098106 2022] [so:warn] [pid 1] AH01574: module mime_module is already loaded, skipping
[Tue Sep 13 18:25:20.098151 2022] [so:warn] [pid 1] AH01574: module mpm_prefork_module is already loaded, skipping
[Tue Sep 13 18:25:20.098195 2022] [so:warn] [pid 1] AH01574: module negotiation_module is already loaded, skipping
[Tue Sep 13 18:25:20.098241 2022] [so:warn] [pid 1] AH01574: module php7_module is already loaded, skipping
[Tue Sep 13 18:25:20.098286 2022] [so:warn] [pid 1] AH01574: module reqtimeout_module is already loaded, skipping
[Tue Sep 13 18:25:20.098325 2022] [so:warn] [pid 1] AH01574: module rewrite_module is already loaded, skipping
[Tue Sep 13 18:25:20.098367 2022] [so:warn] [pid 1] AH01574: module setenvif_module is already loaded, skipping
[Tue Sep 13 18:25:20.098406 2022] [so:warn] [pid 1] AH01574: module status_module is already loaded, skipping
[Tue Sep 13 18:25:20.100451 2022] [alias:warn] [pid 1] AH00671: The Alias directive in /etc/apache2/mods-enabled/alias.conf at line 14 will probably never match because it overlaps an earlier Alias.
AH00526: Syntax error on line 5 of /etc/apache2/ports.conf:
That’s the errro I’m getting after running the container.
Steps to reproduce:
- download the project https://github.com/ShadowFlade/chess
- in the root of it execute
docker-compose up
All of the above is executable considered you havedocker
anddocker-compose
installed.
My first question, hope i did good.
P.S.:If you have any tips on how to better use docker in this project (or in general),I’m all ears.
2
Answers
As far as I know, you can start a single container with a custom command like:
docker run my_container sleep n_seconds
where my_container is the name of the container and n_seconds is the time for the container to remain in that sleeping state.You can look into the container with
docker exec -it my_container /bin/bash
.But maybe this won’t work if your PHP container from the docker-compose file depends on the other containers in some way.
Then you could try to add:
command: sleep n_seconds
to the container in the docker-compose and start it as usual withdocker-compose up
ordocker-compose up -d
, and then look into the container.Sources:
Docker Compose keep container running
https://devopscube.com/keep-docker-container-running/
For troubleshooting one can start built docker image with bash instance as follows:
navigate to config folder and check if config file exists and its content is correct.