Docker Community Forums

Share and learn in the Docker community.

Understanding docker, docker container, docker images


I’m new to docker and wish to learn it. I have experience in FreeBSD Jail if that makes any difference. But to get me started, I would like to know one thing first.

In a FreeBSD Jail, I can connect to it via cli and execute FreeBSD commands like install server software (tomcat, mariadb etc). Basically do all the setup inside the jail to get the application up and running.

Can I also do this in a Docker Container? Run an empty Docker container and ssh to it and install all the software I need? Reason I’m asking is because I’m quite comfortable installing software myself via command line.

Appreciate any feedback.


Hello, @allensandiego !

I will admit that I too am also new to this, but from what I have gathered so far:

When setting up a Container, you can specify within a Dockerfile or a Docker-Compse .yml file, to have various applications installed when the Container is being spin up.

After spinning up the Container, you can access the Container via SSH (following this link is a good basic of how to get to that point:)

There are many other means to access the Container as well, and if I remember correctly, most of them have to be setup/configured within the Dockerfile or Docker-Compose file.

Regarding entering into an empty Container, void of everything including a simple OS, I’m not sure about that. I think it still needs to have some OS/software inside the Container to allow you inside to add software. This question is for someone more knowledgeable than myself.

Sure you can do so but it’s as if you buy a car and push it instead of using the engine. Its not how you use it. :slight_smile:

The Idea behind docker is that you configure your Dockerfile to automatically build and image from its configuration, which includes all necessary software and config. If you would just start an empty docker container and install the required software via ssh, you would need to install the software over and over again if you spin up a new container. With a proper docker image you could spin up infinite amounts of containers and every container is already configured exactly as you want.

Basically instead of installing the software via ssh you just copy these commands in the dockerfile and docker handles the rest for you (a bit simplified explanation)

Hi @jjatinno ,

Thanks. I’ll give this a shot.

Also, I might have used the wrong term when I said empty container. Basically what I meant here it to have a container without any added software except for the OS pre-installed software. At least this way, I can still do apt install or wget inside the container. This is how I see docker container as of now since I don’t know much about it yet.


I did a bit of light reading on the docker file but I still find it a little bit confusing. I’m used to building shell scripts that do wget, then either dpkg or just do apt install line by line. I guess I just need to learn more about the syntax of the docker file.

Also, I still don’t understand. What comes first? Is it the container or the image? Do I build a container from a docker file then build an image from the finished container or do I build an image from a docker file and build a container from that image?

What is Docker & why is Docker needed? – Docker is a containerization platform that packages your application and all its dependencies together in the form of a docker container to ensure that your application works seamlessly in any environment.

What is Container ? – Docker Container is a standardized unit which can be created on the fly to deploy a particular application or environment. It could be an Ubuntu container, CentOs container, etc. to full-fill the requirement from an operating system point of view. Also, it could be an application oriented container like CakePHP container or a Tomcat-Ubuntu container etc.

Let’s understand it with an example:

A company needs to develop a Java Application. In order to do so the developer will setup an environment with tomcat server installed in it. Once the application is developed, it needs to be tested by the tester. Now the tester will again set up tomcat environment from the scratch to test the application. Once the application testing is done, it will be deployed on the production server. Again the production needs an environment with tomcat installed on it, so that it can host the Java application. If you see the same tomcat environment setup is done thrice. There are some issues that I have listed below with this approach:

  1. There is a loss of time and effort.

  2. There could be a version mismatch in different setups i.e. the developer & tester may have installed tomcat 7, however the system admin installed tomcat 9 on the production server.

Now, I will show you how Docker container can be used to prevent this loss.

In this case, the developer will create a tomcat docker image ( An Image is nothing but a blueprint to deploy multiple containers of the same configurations ) using a base image like Ubuntu, which is already existing in Docker Hub (the Hub has some base images available for free) . Now this image can be used by the developer, the tester and the system admin to deploy the tomcat environment. This is how this container solves the problem.

I hope you are with me so far into the article . In case you have any further doubts, please feel to leave a comment, I will be glad to help you.

However, now you would think that this can be done using Virtual Machines as well. However, there is catch if you choose to use virtual machine. Let’s see a comparison between the two to understand this better.