Task "Docker Volumes Mapping"

I got the task with description:

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.

Hello,

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?

Any updates on this? I am facing the same issue. nginx fails to start while mapping. It working fine if I run it without mapping.

Hi @rohitmohanta,
I tested this task and no issue found. Everything is working fine.
Please find the attached SS.

Regards,

Please attach the error screenshot for better visibility. :+1:

Hi @Tej-Singh-Rana

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! :slight_smile:

Hi @rohitmohanta,
Thanks for sharing the feedback. I will forward this to the KKE team.

Best Regards,

We have updated the question. You won’t see that again. :+1:

Thanks,

Oh wow, it took only 11 months to acknowledge and fix such an obvious error …
Congratulations!

Hi @jetchko.jekov,
Sorry for this, somehow we missed it.

Regards,

Do the Docker run command in the new volume directly.