I am very interested in docker and I’ve read about it but I’m a bit confused with containers. When we pull for instance, the official nginx from docker hub, is it only the application or nginx comes with operating system? It seems to me that all containers come with the operating system since with docker exec -it app-name bash i can enter and make updates or install packages. This part is confusing to me because I had the idea that it was only the application and nothing else.
Not all Docker images are built from a Dockerfile that either run the command to start a bash shell explicitly or are based on a Linux Docker image such as “ubuntu”, “debian” that does.
As an example, the tutum/hello-world Docker image is not based on a Linux image and does not invoke the bash shell explicitly. The “ubuntu” Docker image invokes the bash shell explicitly with CMD ["/bin/bash"]
If a Docker image is based on a image that invokes a Linux image such as “ubuntu” as specified in the FROM instruction, or if an image invokes a bash shell explicitly as with CMD ["/bin/bash"] instruction, a interactive terminal/shell may be started on a Docker container for the Docker image.