It took me a good month to learn how to use Docker, and how the docker-compose.yml file should be structured. Whoever thought up the idea deserves a medal! when collaborating with other developers, there's no more "well it works on my computer".
The way it works is genius. What happens is; each container runs it's own Linux kernel, and on top of that, your software, and only the dependencies your software needs. Because each container is essentially isolated, this means your host machine is safe... what I mean by this is... many times in the past when compiling open-source code... messing around with dependencies can sometimes break something on my Linux distro.