Getting Docker in Development Environment Squared Away 1


In this blog post Docker in Development Environment we are starting off the series discussed in this blog post here.  This first volume will cover what it takes to get Docker set up in your development environment. Now this is by no means the ONLY way, this is my way based on my requirements which is to create a back end for building Xamarin Mobile Apps that will connect to a URI endpoint backed by a SQL Database, the real notable thing here is that the URI and Database will be hosted in Docker Containers.

Installing and configuring Docker

Docker has a great website with guidance to install the Docker engine, you will find that there are several host systems that you can use, I am using a Mac so I followed those directions.


A few things to know, at the time of writing this blog, Docker Toolbox has been retired (deemed legacy now) and Hyperkit has replaced it.  Using Hyperkit, the install is easy but it does not include installing Virtual Box which is a component needed to host the VM that Docker will use as its machine. Once Docker is installed even without Virtual box the engine will be up and running but you will not be able to start any machine until Virtual Box is installed and a “default” machine is created.

Docker Engine Utility

Not sure where this will be on a PC anymore, most likely in the task tray, but on a Mac you will see the whale icon at the top of you screen


In clicking into the icon will reveal options for configuration. I will say now something I found out later when I tried to spin up a Container for microsoft/mssql-server-linux … There is a requirement for the “host” machine to have over 2053 MB of RAM. I initially thought it meant the VM host that I created and I bumped it up there but it is actually a configurable property in the tooling. First let me show you the tooling, then I wills how you the configurable property.

The Docker Tooling when you click on the Whale Icon

When you click On Preferences you are able to manipulate the memory and CPU allocation, this resolved the GOTCHA that will happen if your Docker Image requires more memory than what is allocated in the base installation as seen below


Whether you do this now or wait until you meet an error that tells you that you need more memory is up to you, just remember that the fix is here.  Now that you have Docker Engine installed and configured the next item is to get Virtual Box installed and create your first Machine.

Installing Virtual Box & Create your first Machine Instance

This is pretty standard, all you need to do is go to Virtual Box website, download the installer file and execute the process. While you can certainly use Virtual Box to create the VM Machine, I prefer to use the Docker command line utility because it removes the guesswork, creates exactly what you need and the system expects.

The command you need to run is below where “default’ is the name you want to give to the machine.

docker-machine create --driver virtualbox default


Once you have executed that command and open up the Virtual Box app, you should see what I see above. Now that you have your machine created, we should test it… Now I am going to run a few commands below, the 1st will fail, JUST TO ILLUSTRATE A POINT that you need to start and stop your machine.. just good habits..


The command “docker-machine env” gets you environment information about your Docker Machine, but it will work once the machine has started.. If the machine is not in a started state, you will need to issue the “docker-machine start [machinename]” as you see me do in the second green arrow above. All of this by the way, if you are on a windows machine is doable in PowerShell, the one notable difference I know is when you use single quotes ‘ versus double quotes “ in your commands.

Creating your Docker Account and Getting your Base Images

Now that you have your VM up and running, for me, what I wanted to do next was get my base images pulled down so I can create my Code on it.  But before that I created a Docker account on Docker Hub which is quite easy, once you go through the process you get to a dashboard to to this you go to


As for me above, I have a image that I pushed back to Docker Hub that is publicly available to everyone and it is basically a microsoft/aspnetcore image that I have layered with code for an ASP.NET Core Application which means that if you pull this down you can run my App because it is now baked in. This is the Layered Disk that Docker gives you i.e. base image, and I have layered it with my items. To search for images, you type a name in the search box in the top left. For instance, I searched for microsoft/aspnetcore initially, see below:


Now there are several options, but I went with the tried and true official ones from Microsoft and I didn’t need the SDK options so I just went with the first one on the list. To see how to pull it down, if you click into “Details” it will show you the commands and other tidbits. Now like I said you don’t need a Docker Hub account, but this gives you the ability to put up your own images.


Above, I will run this command in my Terminal window and this will pull down the Image. If I run “docker images” it will list all the images I have on my VM as you will see below.


You can run a similar command to pull down the MSSQL-Server-Linux image as well..

docker pull microsoft/mssql-server-linux

and it will pull down that image as well.

Playing Around… You stuck around… got to get the goodies..

So, now that we have pulled down images, lets take the a look at the SQL one … Below lets start up a container to use that Image and lets take a look at the databases therein as well as the ones I created along with the tables


Above you can see us running a command: docker ps –a

that command allows you to see all containers regardless of the state they are in. What do I mean? if you look at the Status the first command says “Exited” which means it is not running. I ran the command so I could get the name of the Container I created earlier “9eb9fc8523b6”

Next I will start that particular container by issuing the command: docker start [container name] [container id]

or as you can see in the second arrow.. I used a partial ID because of the uniqueness of it.  Once I have done that and I run the command: docker ps

and this time without the –a you can see that the status is “Up 2 seconds”  The next thing I did was to log in using SQL CLI which dropped me at the MSSQL prompt


From there, I issued 3 different commands to get some information about what this container has for me. I created the CityInfoDb database from my ASPNET Core App using Entity Framework Core Code First.


This completes Volume 1. Navigate back to the main Blog for links to other posts.

Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “Getting Docker in Development Environment Squared Away