Yay! Another layer of virtualization that eats up our memory and CPU
Docker doesn't do that though, unlike a virtual machine it doesn't just set aside a huge chunk of resources. A Docker container shares a lot of its resources with the host so it's WAY more performant, I can run 15 containers on my machine fine but 3 virtual machines slows it to a crawl.
Why would a Docker image be useful?
One great example is for 100% replicable developer environments. Consider this scenario:
- you've got a set up where you're using the Redis oplog package, that requires a certain version of Redis is installed manually on your machine
- you've also got a second Meteor app that just serves up an API and you let your first app handle the UI
- you've got to manually run that second app on a different port and connect the two apps
- you're seeing an issue in production because your prod servers are running Red Hat Enterprise Linux and you can't replicate the issue on an OSX or windows laptop, you have to install RHEL manually on your machine to debug
All of these are solved with docker, you would just run
docker-compose up and have a full dev environment with all dependencies pre-installed, with multiple apps connected to each other automatically on their own internal network, on the exact same operating system that your production servers are running, all from just running one command on your terminal
I found Docker to be a lot of maintenance, a black box that is hard to update or monitor.
On the contrary, each container and image is controlled from a single file and you can see the exact commands that were run in sequence on a brand new operating system to create that image, and you can see exactly what command is being run inside a container that uses that iamge. There is no "black box", it's totally transparent as to what created your image or container. It requires no maintenance once it's created, as it is 100% replicable and will always behave the exact same on every machine in every environment, whether it's on your local or in AWS. If you do need to update it, it's as easy as modifying your
docker-compose.yml or your
Dockerfile. You can have the exact same functioning dev environment as anyone else on your team with only a single command run on your machine, it's really incredible.