rahulaga-msft
rahulaga-msft

Reputation: 4164

what is "docker container"?

I understand docker engine sits on top of docker host (which is OS) and docker engine pull docker/container images from docker hub (or any other repo). Docker engine interact with OS to configure and set up container out of image pulled as part of "Docker Run" command.

However I quite often also came across term "Docker Container". Is this some another tool and what is its role in entire architecture ? I know there is windows container or linux containers for respective docker host..but what is it Docker Container itself ? Is it something people use loosely to simply refer to container in general ?

Upvotes: 0

Views: 1662

Answers (4)

roschach
roschach

Reputation: 9396

First of all you (generally) start with a Dockerfile which is a script where you setup the docker environment in which you are going to work (the OS, the extra packages etc). If you want is like the source code in typical programming languages.

Dockerfiles are built (with the command sudo docker build pathToDockerfile/ and the result is an image. It is basically a built (or compiled if you prefer) and executable version of the environment described in you Dockerfile. Actually you can download docker images directly from dockerhub. Continuing the simile it is like the compiled executable.

Now you can run the image assigning to it a name or setting different attributes. This is a container. Think for example to a server environment where you might need the same service to be instantiated the same time more than once. Continuing again the simile this is like having the same executable program being launched many times at the same time.

Upvotes: 0

scourer
scourer

Reputation: 49

Docker container are nothing but processes which are spawned using image as a source.

The processes are sandboxed(isolated) from other processes in terms of namespaces and controlled in terms of memory, cpu, etc. using control groups. Control groups and namespaces are Linux kernel features which help in creating a sandboxed environment to run processes in isolation.

Container is a name docker uses to indicate these sandboxed processes.


Some trivia - the concept sandboxing process is also present in FreeBSD and it is called Jails. While the concept isn’t new in terms on core technology. Docker were innovative to imagine entire ecosystem in terms of containers and provide excellent tools on top of kernel features.

Upvotes: 0

Hemant Singh
Hemant Singh

Reputation: 1608

In simple words, when you execute a docker image, it will spawn a docker container. You can relate it to Java class(as docker image), and when we initialize a class it will create an object(docker container).

So docker container is an executable form of a docker image. You can have multiple Docker containers from a single docker image.

Upvotes: 8

Matt D
Matt D

Reputation: 146

A docker container is an image that is an (think of it as a tarball, or archive) executable package that can stand on its own. The image has everything it needs to run such as software, runtimes, tools, libraries, etc. Check out Docker for more information.

Upvotes: 0

Related Questions