I am trying to create 2 container.
- First Container (mynginx) will have Nginx server running on 8080 port and have few data volumes like nginx/conf/nginx.conf
- Second container (nginxconf) is my helper container to edit nginx.conf file by accessing the volumes(nginx/conf/nginx.conf) using --volumes-from option.
I am able to edit the nginx.conf file and successfully change the port from 8080 to 8085. But now facing below problems-:
- Restarting service in mynginx container will run service on 8085 but how this port will be mapped to host public port. As currently docker ps is howing 8080 port is mapped to 32768 and after service restart , it is not changing at all and i am not able to access nginx from host system.
- If i am trying to save the container state into image as i have change the port from 8080 to 8085, docker commit is not saving this port change into new image as nginx/conf/nginx.conf is a volume where commit might not working.
Please advise how to use helper container for editing configuration in actual container or i am going on wrong way at all.
Note-: I have referred this topic on docker blog.