I am new to docker. In our docker environment - Apache has been installed and it is up and running.
Now I need to get into the container, modify the httpd.conf
, save it and then I need to restart the apache.
Can you guys please let me know, what needs to be done. I am pretty much confused about - 'exec' and 'attach' commands.
In your case, try running the script in the Dockerfile located in the /usr/local/bin/ directory as the CMD command and re-run docker-compose up -d to see if the Apache is started or not.
No need to attach or exec (which is really a debug feature anyway)
You can use docker cp
to copy a local version of your httpd.conf
to the container. (That way, you can modify the file from the comfort of your local environment)
docker cp httpd.conf <yourcontainer_name>:/path/to/httpd.conf
Once that is done, you can send an USR1 signal to ask for a graceful restart (see docker kill
syntax):
docker kill --signal="USR1" <yourcontainer_name>
Replace <yourcontainer_name>
by the container id or name which is running Apache.
That will only work if the main process launched by your container is
CMD ["apachectl", "-DFOREGROUND"]
See more at "Docker: How to restart a service running in Docker Container"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With