Skip to content

Instantly share code, notes, and snippets.

@cweibel
Last active November 9, 2017 01:30
Show Gist options
  • Save cweibel/822096152b0bbc1d8c18bdb6311bd35c to your computer and use it in GitHub Desktop.
Save cweibel/822096152b0bbc1d8c18bdb6311bd35c to your computer and use it in GitHub Desktop.
Docker Your Database Presentation Notes

Installing Docker Toolbox

Start out by going to https://kitematic.com and download the “Docker Toolbox”

This will install VirtualBox if you don’t already have it.

While on the webpage go ahead and create a new Docker ID.

Postgres

Let’s jump right in, there is a library of prebuilt docker containers so let’s start with Postgres.

Search for Postgres, notice the official tag.

Open a terminal session and run:

psql -U postgres

Then you can select the current date:

select now();

MySQL

Search for mysql

When you start you’ll get an error message.  Go to the Settings tab and add an environment variable:

MYSQL_ROOT_PASSWORD pickles

Restart so the change is picked up, launch EXEC and connect to the db:

mysql -u root -p

enter `pickles` for password

Like Postgres we’ll select the current date:

select now();

MS SQL Server

Search for mssql-server-linux.

Upon start it will error out on memory.  In Kinematic click on the gear in the lower left corner to bring up preferences.  Check the “Shutdown Linux VM on Closing Kinematic” checkbox.  Then shutdown.  Go into VirtualBox and add RAM. Reopen Kitematic.

Start and observe error message about accepting EULA.  Go to Settings and add:

ACCEPT_EULA      Y
SA_PASSWORD      b0yg1rl01

Again RESTART and open EXEC and connect to sqlcmd:

/opt/mssql-tools/bin/sqlcmd -H 127.0.0.1 -U sa -P b0yg1rl01

Like the last two database platforms show the current date:

1> select getdate()
2> go

Apache Cassandra

Let’s see a big data tool with multiple nodes.

Search for cassandra

Nothing needs to configure here.  The command line tool cqlsh is used to query the cluster.  Open EXEC:

cqlsh

And again we’ll select the date/time as proof of life:

SELECT dateof(now()) FROM system.local ;

Ghost

We can also experiment with containers which have nothing to do with databases.  Ghost is a blog post tool, in fact we use this for the Steak & Rain blog.

Search for ghost

There is no command line tooling so we open a browser.  To know where to navigate to open Settings > Hostname / Ports and grab the Published IP:Port and use this for your url.

Final Thoughts

That’s it.  There are all sorts of other containers useful for testing out different OS versions, Minecraft servers, Wordpress, etc. The rest of the time I’ll help those that would like the tool installed on their own equipment.  Feel free to experiment and share with others any cool tricks you discover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment