Docker: "Saving Lives" for occasional instructors


Some months ago, I was introducing different types of databases to an internal audience.
Such task would have meant tedious environment preparations.
Docker, however, has (also) changed this scenario dramatically.

One's Computer as a Host

That is the one I would have probably done: install the different database servers in my machine and have them running as I was going through the different paradigms.

Probably, some installation would have left some rubbish behind after uninstalling the server.
But my computer gets restored every so often, so this option would not have been the biggest of deals.

Likely, some eager server would have tried to take all my RAM over and performance would have been a little bit more sluggish that it could have been.
But, again, nothing one can't live with and blame on hardware.

More annoyingly, I would not have been able to change startup toggles and most definitely I would have bumped into a server that does not take Windows (the OS of my work computer) as a first-class citizen.
Which leads to...

The Virtual Machine Dance

Some of the servers I showcased are *nix dwellers, so I could have provisioned some Virtual Machines using Hyper-V and manually installed the services needed and started them on demand as I changed subjects.

I could have even automated the process doing some Powershell scripting or even streamlined provisioning even more using (the somewhat on its way-out) Vagrant.

But VMs, though convenient, are still somewhat heavy-weight and slow to kickstart (talking about tens of seconds, even minutes).

Docker as a game-changer

Docker was totally a game changer for my requirements.

I could easily run some simple docker commands to provision each database server and have it running in a matter of seconds.

For example:

docker run --name some-postgres -e POSTGRES_PASSWORD=1234 -p 5432:5432 -d postgres:10.5-alpine


docker run --name some-mongo -d -p 27017:27017 mongo:4.0.1-xenial --smallfiles

No installers (beyond a working Docker installation in Windows 10), no leftovers, blazing fast to start and pretty lightweight.

When the course finshed, I could easily prune the system to remove containers, images and such free the few resources small images take.
A true instructor's dream.

share class