Some questions about docker

Hello,
I am new to Docker and I want to install a web server like Apache or Nginx on Docker. I have some questions:
1- Does the Docker image include the operating system?

2- Should I use docker pull command or docker-compose tool?

Thank you.

I think ChatGPT sounds about right:

A Docker image does not include a full operating system (OS). Instead, it includes just enough of the OS components required to run the application it is designed to host. This typically includes the application itself, any necessary dependencies, libraries, and environment settings, but not the full kernel, drivers, or system software that you would find in a traditional OS image.
Docker containers share the host system’s kernel rather than including their own. This is part of what makes Docker containers lightweight and efficient compared to full virtual machine (VM) environments


docker pull is used to pull an image from the registry to the local host to be able to start a container.

docker compose is used to run containers defined in a compose file. It will automatically use docker pull if images are not present.

And docker compose pull will pull all images from the compose file. This is useful if you use tag latest and a new version has been published to the repository since the last pull.

1 Like

A container image could contain a single binary. and never a full OS.
As it was already mentioned before me, a container image doesn’t contain the kernel even when it contains almost everything else, but the less it contains the better in terms of security. Docker containers are usually used to run a single or a few processes and have a small image, while LXC containers are larger and used almost like a full OS. Of course, without the kernel.

2 Likes

Hello,
I want to install Docker and docker-compose on the Debian. Is the following command enough?
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

That is a great question!

And it has been asked so many times, that someone sat down and actually created a full documentation for it:

1 Like

Hello,
Thanks.
I want to start a website, its web server is Apache or Nginx and its database is MongoDB:
1- Can I install Nginx on one container and MongoDB on another and then connect the two containers together?

2- What is the best scenario for such a project?

3- Is there a newer tool than Docker Compose?

I recommend you just Internet search for a tutorial, there are probably a 100 out there.

Use a separate container for webapp and database. Connect them to a Docker network, use the container name to connect, use docker compose.

1 Like

Hi,
Thanks again.
Is there a special folder for making containers? For example, the /var/www directory is for the web server.