Why use Docker?

Why use Docker?

So you’re asking the question “Why use docker?”

A good reason to use docker is because it makes setting up services easier. What I mean by this is think back to a time you needed to install a service on a server, but with that service you need to install packages for it to work, but the packages you have aren’t compatible. You troubleshoot the issues and manage to get the service running.

So now you’ve worked through the problem, you finally get the service installed and everything is working. Fantastic! Now what about the next time? You’re going to go through the same process all over again. Wouldn’t it be easier to say have something which can just run that service instantly?

This is where docker and containerising the service comes in handy. Because what we can do is take that entire process, put it into an image, then call that image and run it as a container.

A good example to think of is imagine you need to setup redis. Instead of downloading the files and going through the quickstart guide. It can be as simple as running one command:

docker run -it redis

And that’s it. Docker will automatically look on dockerhub to see if there is an image with the reference of “redis” and pull the latest version as we didn’t specify a version. Redis is now running as a process. It’s that simple.

Below is an example of running the command