Talk about Docker
Few weeks ago, as every month, my company has organised their Tech evening.
This time, it was about Docker.
As a long time user of virtualization and for the past year of Docker, I offered to talk about how to integrate docker in our everyday work.
As a front end developper, I use very often Gulp, Grunt and/or Node.js in my projects. These tools are pretty awesome but when I deal with external libs I have to be really careful of what I put in my dependencies file.
The issue is, if you forget (you shouldn't but sometime...) to put a dependency in your file before commiting your feature on your Git , your CI tool will crash.
- Delete node_module & bower_components, then reinstall your dependencies every time
- Use a simulated CI with docker for exemple
Only few people know how to use docker so I made a presentation about Docker and how we can use it in dev.
You can find the slides here: https://github.com/AshDevFr/talk-docker
You will find plenty of articles about Docker on the internet. That is why I won't explain to you what Docker IS, instead I will explain why you could, and maybe should, use it as a web developer.
Let say you are working on a MEAN stack. So you have Node, Express, Mongo and Angular in the project. There are a lot of dependencies.
Some of these dependencies are in the package.json, and some in the bower.json
How to run your MEAN project
The normal way
- Download & install Node.js & npm
- Download & install MongoDB
- Install a package manager (Bower)
- Install a task runner (gulp / grunt)
- Run your app & enjoy
It is a lot to do and install, but you only have to do it once. Do you ?
The docker & compose's way
- Download & install Docker
- Run your app & enjoy
It is less than the 'normal way'
The thing is, if you use a CI like system (with Docker & Compose), you will prevent possible human-interaction issues.
During a project development cycle, sometimes, you have to change things in the project's settings (dependencies, task manager, etc...). If you run your application only on your computer the normal way, you could install dependencies, forget to add them to the package.json, and push your code on the repository.
The result will be that on your CI (Jenkins or another), the project build will break.
The real interest in using Docker is mainly to prevent these kinds of issues. It will simulate a CI system and will warn you about it.