I have made a docker container from nginx running in background this way:
docker run -d --name nginx1 -p 49699:80 nginx
When I go to localhost:49699 on a browser with cleared cache it works properly as I get the nginx vanilla index.html page
But then, if I launch another container in interactive mode first, and then exit and launch it again it doesn't works. So what I mean here, is that if I first stop and remove container nginx1 mentioned above, and then I:
docker run -it --name nginx2 -p 49699:80 nginx bash
I create a container called "nginx2" and I immediately get into it's bash. The I hit exit without changing anything inside the container. And since it was interactive, the container stops after I exited the bash. So I the re-start it with docker start nginx2 and it's running with the expect port forwarding as marked by docker ps.
If I then go to localhost:4699 it doesn't shows me nginx.
So it seems that if a nginx container was created in interactive mode. Even if we get out and start the process again with docker start <nginx_container> then nginx won't actually work. As if the interactive mode the container was created with is a process that runs above the nginx processes running inside the container.
I am just trying to understand what the "interactive" mode does to a container that is supposed to have had another process (like nginx) running and ready for port-forwarding. Does interactive mode kills nginx processes?