We're going to use the Docker container engine. Firstly, we will need to install this and validate that it is operating correctly. To do this head over to http://www.docker.com and install the appropriate binary for our system. Docker supports Linux, Windows, and Mac natively.
We can check that Docker was installed successfully by opening a shell and running the following:
$ docker run hello-world
This command will pull the hello-world image from Docker Hub - a central repository of public Docker images, create a new container from that image, and run it. The executable within the container will output hello from docker along with some help text.
Docker was originally built for Linux-based operating systems. Until recently running Docker on Mac or Windows required the use of a virtual machine using either VirtualBox or VMWare. However, Docker is now available natively on both Mac and Windows. This requires a recent version of macOS or Windows 10 or greater - so be sure to check the prerequisites when installing Docker.
Once we have Docker installed we can press ahead. In this recipe, we will be adding a new microservice that stores data into a MongoDB container. We'll be adding this new service into ourĀ micro folder, based on how the micro folder ended up in the previous recipe, Standardizing service boilerplate.