DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 970,177 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Docker
jimenezfede
jimenezfede

Posted on

Docker

What does Docker do? What are containers? What are images? Why is this service so popular? I kept hearing about docker and how it uses containers. But had no clue as to why or what exactly these containers are or do. So after spending a couple of hours on dockers website, I got my answers.

Images

To create an image, Docker uses a file called Dockerfile. This file contains a list of commands of what should be in an image when it gets built. Once this list is completed, it’s sent to the Docker engine which then builds the image by running the commands. Each of these commands are layers. When a change is made on a certain layer, then only that layer gets rebuilt. This is why the containers are β€˜lightweight’. So let’s say I have an outfit. My shirt, pants, and shoes are separate layers. And if I want to change my shirt, instead of having to get a whole new outfit, I can just throw away my shirt and get a new one.

Containers

A container is a process that’s kept separate from the rest of the system. It holds all the configurations and supporting files, which are images, needed for an app to run. It can have one or multiple images. The set up is made so that if an image goes down, then it can easily and quickly be replaced. A container also has its own file system and network. This is why when running the container, a specific port needs to be given. And this is also what makes it really secure. And if more than one container is needed on the same network, then they can be made to share the port. Containers are simply set on β€˜isolation’ mode by default.

isolation

Docker Client

Docker Client are the commands to run when communicating with Docker.

  • Docker build - builds the Dockerfile
  • Docker run β€” runs a new container
  • Docker image - manages an image
  • Docker container - manages a container
  • Docker pull β€” pulls an image from DockerHub
  • Docker push - pushes an image to DockerHub

Docker solves the environmental issues of running an application on ones own computer. No more having to worry about if my computer is gonna give me problems with running my app. I have a hard enough time just getting through git commands and eslint format issues when trying to commit.

too many problems
I can have my whole app run with docker. The code I write, the database, whatever I want. Simply just set everything in containers and let them work their magic. Gives me more time to code more console.log(β€˜Hello World’).

Sources

Top comments (0)

πŸ‘€ Just want to lurk?

That's fine, you can still create an account and turn on features like 🌚 dark mode.