Learning Docker

July 4, 2019, 9:21 p.m.

Ever since I started building websites I always used some kind of AMP stack. As my skills grew my stack was growing with it. First problems occurred when we had two major versions of PHP out in the wild - 4 and 5. After a while problems were piling up as I was adding Redis, Mongo, APC, Memcached, Elasticsearch and other popular tools to my stack.

here was no way to manage this stack and keep sanity at the same time. It was a sign that I need to upgrade. And I did. I started to use Vagrant. Best time ever. I was able to build multiple stacks with different configurations. When I discovered Homestead I was delighted. All cool stuff in one place.

But all of the sudden I encountered another problem. I switched from Windows based laptop to MackBook Pro. Where is the problem you ask? Disk size. I choose small disk - 128GB. “Why do I need more space? I will use cloud.”. Pretty fast I learned how wrong I was. After migrating few projects I was working on, my disk was full. Back then the F word was the word of the day.

Luckily for me a friend of mine was nagging about Docker for some time so I was familiar with it. And I knew it was my last resort. I started using Docker few weeks ago and it’s quite awesome. So awesome I decided to record my progress and share it with you. For next few weeks you will be able to read about progress I have made as well as Docker itself. We start with some theory.

What is Docker?

Docker is a software container platform which means that instead of installing whole operating system in order to use single app we can “install” this app in isolated container and link it with other containers. Why is that better solution than virtual machine? First, we don't need to install whole operating system. This saves us a lot of space and time. Next, we can use containers as building blocks. If we need to modify our stack we don't need to prepare new virtual machine. We will create Dockerfile and/or update docker-compose file. Last but not least we can use Docker as our testing environment - best use case is Gitlab CI running on Docker. Is’s not all Docker can do. We can for instance deploy app and its environment to our hosting provider. I won’t say that possibilities are endless because I know to little about it (for now).

In next article I will explain what Dockerfile is and we what can do with it.

Posts in this series

  1. Running Docker commands
  2. Dockerfile