Getting Started with Docker

Dhathri Vupparapalli
3 min readJul 31, 2021

--

Welcome! Let’s get started with Docker.

This blog assumes that you have the latest version of docker installed in your systems. If not, then get Docker here. Installing Docker means that we are downloading a technological toolbox that makes the host system compatible to run different OS-based images. Don't worry if you don't understand what I mean by this. We will see all of this in detail.

Read this to know more about docker installation.

Running a sample container

Open a command prompt or bash window and run the following command.

docker run -d -p 80:80 docker/getting-started

As we can see, we are using some flags here. Let's get to know them:

  • -d: Run container in detached mode (in the background). Usually, containers run in an attached mode which means that they will be attached to the terminal session, we can see the output and messages. If we don't want to see the output and messages we can run it in detached mode.
  • -p 80:80: Used to map the host’s port to the container's port. In this case, we are mapping port 80 of the host to port 80 of the container. Ports can be anything. for eg., we could also use -p 3000:3000.
  • docker/getting-started: The image we are going to use.

We can also shorten the full command, by combining all the flags. For example, the above command could be written as:

docker run -dp 80:80 docker/getting-started

Now, a container is running in your system. To see all the running containers we have a command. But before going to commands, let us see those running containers in the Docker desktop’s dashboard.

Read this to know where Docker is used.

Docker Dashboard:

To view Docker Dashboard, we need to open the Docker desktop. Docker desktop does not start automatically. To start it search for Docker and select docker desktop in search results.

When the whale icon in the status bar stays steady, Docker Desktop is up and running and is accessible from any terminal window. Now, you will be able to see the Docker dashboard and there will be a container running which we started just now. The container name (sleepy_kowelevski below) is a random name. It can be different for you.

What is a container?

Now that we have a container running in our system, Let's see what a container is. In simple words, the container is nothing but an application running in the system which has been isolated from other running applications.

Read What is a container to know more about containers.

What is a container Image?

For a container to run it needs a set of instructions to execute. Container image provides that file system that has instructions for a container to run. Image contains all the dependencies, scripts, libraries for an application to run.

Read What is Image to know more about it.

Conclusion

In this blog, we have seen how to run a container, and we saw also saw the running containers in the docker dashboard. We have also seen the command that is needed to run a container and also the flags that are used to run them in detached mode.

Related articles:

--

--