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

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

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

Create account Log in
けぇん
けぇん

Posted on

Why don't you use docker?

There are so many pros to use docker. If you don't use it now, you only lack knowledge of it.
I'll explain docker by describing the background of the dev environment and how docker saves the your awful developer life.

Execution Environment

Let's think about how your image recognition application runs on your computer. Your application must use Tensorflow as a library and it must be written in python. And python runs on Mac OS and Mac OS runs on your computer. You need all of them to run your image recognition apps and none of them must not be missed. A set of them is execution environment.

Container

Container is a small lightweight virtual execution environment. Container includes all you need to run application you want to run, such as simple Linux OS, runtime, libraries, environment values and so on. Docker Engine installed on your host OS emulates Linux OS so container is much smaller than Virtual Machine.

Docker

Docker is a platform that you can build, run, convey containers.

To build a container.

You can build a container from a Docker Image. Docker Image includes information that you need to build execution environment such as Linux distribution, runtime , library and code you wrote. Docker reads your Docker Image ,installs all libraries written in the Docker Image, and builds a Container. You can build many containers by a single image and reproduce same execution environment on many machines. You don't need to configure each machine anymore. Isn't it awesome?

To run a container everywhere.

You can run any containers on any machine if you install docker engine on it. Your program runs on your laptop and also can run on cloud or on your friend's pc. It doesn't matter that OS is windows, mac, or Linux. It's awesome?

To convey a container.

DockerHub ,which is like a GitHub, lets you share your images. There are many official images on dockerhub and you can pull and build them immediately by typing command 'docker run ~~~'. Try run official apache image and you can build web server in a few minutes. Isn't it awesome?

Sample Use Cases

There are so many cases to use docker and docker must save your dev life.

CASE1

You downloaded a code from github but as soon as you run the code, console output many error messages and you decided to stop to use it.

The cause of this problem may be that you didn't have necessary runtime or libraries, or you don't have appropriate environment variables like PATH.
But if the distributor share the image of that code, you can pull it and definitely could run the code and you must be happy with it!!

CASE2

You needed to version up runtime like python 3.6 to 3.7 to run a certain application. It succeed and you could run the file but a disaster happened. Your codes for your research got to be unable to run anymore. You downgraded runtime soon after that.

The cause of this problem is that you installed runtime globally on your host OS and shared it through all of your programs. It can be happened if you use libraries globally and share them. Version of runtime and library matters, so you should not share them through all programs. You should install runtime and libraries on each projects. So Docker appears. One Container One Process policy isolates execution environments from each process. No more problems happens here.

Docker Cons

There are so many pros to use docker. You may concern about cons of docker.
I can tell you a good news. There's no cons to use docker, at all.

Use Docker

You must use docker and everyone would be happy.
Say it to your boss immediately, 'Why our project do not use docker?'

Top comments (2)

Collapse
 
anduser96 profile image
Andrei Gatej

I really like the way you explain things! Thanks for sharing!
Now I definitely got to try Docker.

Collapse
 
yuno_miyako profile image
けぇん Author

Thank you. You are the first commenter of my posts.
Yeah try docker and you will like it.

Update Your DEV Experience Level:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›