The Nautilus DevOps team is testing applications containerization, which issupposed to be migrated on docker container-based environments soon. In today's stand-up meeting one of the team members has been assigned a task to create and test a docker container with certain requirements. Below are more details:
a. On App Server 2 in Stratos DC pull nginx image (preferably latest tag but others should work too).
b. Create a new container with name games from the image you just pulled.
c. Map the host volume /opt/itadmin with container volume /var. There is an sample.txt file present on same server under /tmp; copy that file to /opt/itadmin. Also please keep the container in running state.
The problem is that if you mount any volume on /var inside container, you are breaking a whole lot of things. nginx included.
You will not be breaking nginx if you map the host volume to the docker container volume. The idea here is for you to run (docker exec -it games(container_name) bash) and you will be able to see the file you copied into the host volume(/opt/itadmin)
I did not say that you will be breaking nginx if you map the host volume to the docker container volume.
I said that you will break it if you mount dir on /var.
/var is an essential directory in Linux FHS and contains a whole bunch of needed subdirectories including /var/run used (or was used at the time) by nginx in the docker container to store its pid file or /var/log for storing log files. And of course, nginx fails to start if it can’t access /var/run or /var/log
I faced the same problem: if I map host dir to /var inside docker container, then nginx fails to start (obviously). If I map host dir to /var/some-dir then the task fails. What is the desired state of this container?
I tried again and this time I was asked to use a different directory. I completed it successfully. I am still not sure what was causing the issue. But as I can you have mapped the /tmp directory. Please try it with /var directory and may be you’ll encounter the issue as mentioned by people in this thread. Thanks!