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.
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"