If you’re a web developer and you’re not using Docker already you’re missing a lot of things! Yeah, I understand what’s keeping you away even if you’ve heard a lot of hype about it from co-workers, friends, etc.
Well, the fact is learning something new has a learning curve and who’s has that time right? But, let me tell you this, I’ve been in the same situation until I had the courage to make the switch after dealing with an immense amount of frustration with local development environments like XAMPP, WAMP, Vagrant, etc
Here’s are the problems which I dealt with and I am sure you’d agree on most of them
Switching to a different PHP version and running 2 different projects
Working on 2 different projects with isolated PHP running, that’s impossible with others. You might be able to do that by using heavy VMs running on your system but that’s gonna be a sucker of system resources
Installing PHP extensions
It’s big trouble to get a PHP extension installed in most local development environments. Of course, it’s possible but you might end up googling the whole day to get it working, or even worse it might take another day.
Even if you’re able to do that the extension is enabled for all your projects and might create unnecessary problems where you don’t need them. Like Xdebug, it will be enabled on all your projects until you explicitly change it in the config
Multiple project setup
There’s no concept of multiple projects in most of the local development environments. All you’ve is http://localhost and you put everything in there. However, you could use virtual hosts in Apache / Nginx to map a folder with a local domain other than localhost and that requires a lot of time editing config files, testing, troubleshooting and so on.
A different MySQL database?
Well, no way it’s just 1. All you get is 1 database and 1 everything
Life after uploading codes on a production server
Well, you know it. You’re dead. Even if everything works just fine, you’d always end up having something which works in local setup but not on the server. You cannot agree more on this!
If you’re still here and reading, you can solve all these problems now and forever by using Docker.
Docker has few basic concepts, a docker file, a docker compose file and networks
You can get started just by learning how to create a docker file which is the blueprint of your server and configurations
Or, you may use an existing docker file built by someone else. Everything you want is written in a docker file or a compose file by an awesome guy!
But, here’s a catch. You may get it pretty easily but using it can get very difficult depending upon your understanding of how linux servers work because everything you see in a Dockerfile is just line by line instructions that docker processes while building a container (an apache server for example)
What has worked really well for me is starting from the basics, from the ground up.
Try creating your own docker file and learn what’s needed on the way. It may take some time but it’s totally worth it.
And if you’re feeling lazy at the moment and you want to just use something which is built on top of Docker and solves all your problem, then try the DockerStacks app!