Starting with docker

First off, i’ve got zero experience with Docker, so i just started googling around to find out what i had to do. To get things running, i started off with Windows 10 pro and a basic understanding of Powershell.

To install Docker, i went to the Docker download site, got the installer and ran it. After a reboot, Docker was up. But doing quite nothing šŸ™‚

To show it was alive, my first command!

docker --version

Ok, it’s alive! But what if you want to know more. Well, you kan use this:

docker info

I won’t post the screenshot but suffice to say it prints out a lot of info about your Docker system.Ā 
On the Docker tutorial site there’s a neat hello world script you can try out. It checks a number of things, like your internet connection and if you’re lucky it all runs and you get a challenge:

docker run hello-world
Hello Docker world!

You can run the Ubuntu image but i was interested in something else: i wanted a SQL Server container!
Before i got to do that, i had to setup some Linux things on my machine. Because most commands invoke the Bash shell, i had to make sure it would work. First of all i enabled the linux feature on my machine:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

And, another restart! After that i selected the Ubuntu distro from the Windows Store, installed that as well and made sureĀ  i could connect to it.

Oooeerrss… Colors!

Onwards to SQL! You can find a fine tutorial on the Microsoft site on how to install and run SQL Server. For my first run i went with some basic, yes the horrible ones, settings.Ā 

First of all you need to pull the image. I went for the latest 2017, but you can get the 2019 preview as well.Ā 

docker pull

This command ran for about 2 minutes and it was done. Nice start! Now, to start the container. You need to set a few variables to get it running:

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=[YourStr0ngPa$$w0rd]" `
   -p 11433:1433 --name sql1 `

If you did this correctly, the system will start. Keen readers will see that there are two different ports in the script. Port 11433 and 1433. The latter one is the default port, the first one is custom one. Because my machine already hosts a SQL 2017 instance, i had to reroute the traffic to the container.Ā 

Now you should be able to connect to the container. The command Microsoft suggests is this:

docker exec -it sql1 "bash"

This should launch your bash shell and give you access to your container. But for me, nothing happened. At all. The powershell command just stops there. I haven’t figured out what is wrong.

If you want to use the command line, you can use the Kitematic extension from Docker. This will give you the possibility to connect to your container and run start the SQLCMD utility.

Click the right button for some magic

The above # is all you will get from the exec. To start the slqcmd you need the following command:

/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '<YourNewStrong!Passw0rd>'

If this works, you’ll get the next screen:

Never use a wrong password…

Now, let’s check the version of my SQL Instance:

Command line’s can be nice

Now, i’ve grown up in the GUI era, so i’d like to connect with SSMS. To do that, i use the following connection info:

Connect to the box

After entering my password i can connect. Remember the weird portnumber i used for my container? This is why that port number is usefull. So when i check the version of the SQL Instance i’m connected to, i get to do and see this:

This i like!

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen. logo

Je reageert onder je account. Log uit /  Bijwerken )

Google photo

Je reageert onder je Google account. Log uit /  Bijwerken )


Je reageert onder je Twitter account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )

Verbinden met %s