Ilker Furkan Kahyalar

Ilker Furkan Kahyalar

Software Engineer







Building Trioway | Docker 101

This article is a part of the series “Building Trioway” which contains researches and decisions that we made during while we are creating Trioway.

What is Docker?

We were looking for a solution to save time while deploying and scaling. So we ended up in Docker. Docker is a container platform basically, but we should also explain What is container? then. A container is a standardized unit of software, and you can imagine it as a fishbowl with fishes and all the accessories which you wanted inside. It’s the best environment for that fish and it can live freely inside that bowl. Imagine that you can specify the water temperature, amount of water, bowl size, fish count, fish breed, accessories and so on, and when you specify these settings once. You can order the same environment countlessly and you and rest assured that your fish will behave the same in all the fishbowls.


The easiest way to go is Docker for Mac or Docker for Windows depending on your OS. This will install the necessary utilities for your computer, but if you want some GUI for your containers and images there is a tool called Kitematic. Kitematic is also tool made by Docker and it is good for first-timers to see the running containers and their states in GUI.

You can download Kitematic from here.

Getting ready

First things first, make sure your Docker is up and running. You can check the installation from the command line.

$ docker --version
Docker version 19.03, build c97c6d6

$ docker-compose --version
docker-compose version 1.24.1, build 8dd22a9

$ docker-machine --version
docker-machine version 0.16.0, build 9ba6da9


Our mission was trying to run a Redis server on a Docker container, so this “Usage” part is explained by Redis. For running a Redis instance in Docker, we need Redis image to run a container with. So, let’s run this container then!

$ docker run -d -p 6379:6379 --name my-redis-instance redis
Unable to find image 'redis:latest' locally
latest: Pulling from library/redis
f5d23c7fed46: Pull complete
a4a5c04dafc1: Pull complete
605bafc84bc9: Pull complete
f07a4e35cd96: Pull complete
17944e5e3eb7: Pull complete
6f875a8605e0: Pull complete
Digest: sha256:8888f6cd2509062a377e903e17777b4a6d59c92769f6807f034fa345da9eebcf
Status: Downloaded newer image for redis:latest

If your terminal log also looks like this, everything should be working fine, but first, let’s explain the command which we wrote.

-d stands for detached, so our server can run in the background, otherwise, it’ll occupy our command line.

-p stands for the port. Never forget, these containers are virtual machines. You are not running them locally, so you need to expose the container’s port and attach to your computer’s port. By the way, 6379 is default port for Redis.

–name stands for name obviously. It’s a good idea that you provide a name for your container, otherwise Docker will generate a random name like “cactus_lover”. For management purposes, provide a name for your container.

redis is our image name and if you don’t specify a version or tag, it will pull the latest version of that image. You can specify the tag with a colon. (Ex: redis:latest)

Testing the container

If everything is perfect, we can test our server is it running or not. Remember that, we run the server in detached mode. For testing or using the CLI, we need shell access.

$ docker exec -it my-redis-instance redis-cli> ping

If you see this on your CLI, congratulations! You are running your Redis server in Docker, but before that let’s explain the command.

-it stands for -i and -t. Let’s explain separately. -i stands for interactive. It allows us to send inputs to the container. -t stands for “Allocate a pseudo-TTY”, which is “A device that has the functions of a physical terminal without actually being one.” Basically, it allocates a terminal for us to control our container.

my-redis-instance is our container name. See, it’s much better readable and understandable than “cactus_lover”.

ping is a command for checking the server whether it is running or down.

Also for stopping a container, simply just run:

$ docker kill my-redis-instance

Then, what?

Docker is an endless ocean. You can dive deep and try different images and different configurations. This is the most basic usage of Docker. There are more technologies like “Docker Swarm”, “Docker Compose” and “Kubernetes”. I hope that we will cover these topics and technologies, while we are developing the Trioway.


I hope you liked what you heard and I am really looking forward to seeing you in the next one! If you don’t want to miss any content, you can subscribe to the website and I will let you know whenever something new going on here!

Also you can reach out to me from the “Contact” section. Feel free to share your thoughs or suggest any ideas. I am reading all the messages and I will reply yours as soon as possible!

As you might know me, I like coffee and high-quality content. If you want to support me and my effort, why not a little caffeine boost ha? 😎

Buy Me A Coffee

Until next one,