Some Confusion about Mirroring and Containers in docker

  docker, question

Recently, I was learning docker. At first, I thought I could distinguish the difference between mirror image and container. I thought that mirror image is an environment that is configured and installed with various dependent operating systems. The container is a process running on the configured operating system.

But then I discovered that mirroring is not only an operating system, but also an application, such as nginx, redis, etc. What is the container that runs from the nginx or redis image? I can understand the container built from the operating system, but I can’t understand the container built from an application.

Then the question arises:
1, does it mean that I wrote a program, packaged and compiled into an executable file, this executable file is a mirror image, what is the container that runs from this executable file? This executable process?
2. If the image is an executable file written by nginx or redis or myself, does the image also include the underlying things such as the operating system?
3. Does the company that has already been containerized compile the code into a (executable) image and then build the container directly from this image? Instead of mirroring with the operating system

My understanding is that there are two kinds of situations. Let me give you an example:
1. Taking php as an example, php project startup depends on php environment, nginx environment. It is obviously unreasonable to package php into a mirror image. My method is: build a PHP container, expose its port for nginx container, nginx container maps its port to the host computer, and the host computer mounts its working directory into the container, so the host computer can access the started project content;
1. Take the node project as an example. The node project only depends on the node environment. My method is to mount the working directory in the mirror and pack it up. Pull up the mirror. However, it needs to be restarted after modifying the file every time.buildMirror image.

Above