{"id":82,"date":"2017-05-31T00:00:00","date_gmt":"2017-05-31T00:00:00","guid":{"rendered":"http:\/\/ssdnodes.billabailey.com\/2017\/05\/31\/5-cool-and-sometimes-impractical-things-to-do-with-docker\/"},"modified":"2025-05-18T12:29:54","modified_gmt":"2025-05-18T12:29:54","slug":"5-cool-things-docker","status":"publish","type":"post","link":"https:\/\/www.ssdnodes.com\/blog\/5-cool-things-docker\/","title":{"rendered":"Five cool (and impractical) things to do with Docker"},"content":{"rendered":"<p>If you\u2019re part of our containers preview, you\u2019ll have access to Docker, the container-based software that\u2019s had people buzzing for years, now. Once you\u2019ve gone through the <a href=\"https:\/\/www.ssdnodes.com\/blog\/tutorial-getting-started-with-docker-on-your-vps\/\">installation and configuration process<\/a>, you\u2019re ready to start doing some really cool things with your VPS that are only possible because of containers.<\/p>\n<p>Some of these are wildly impractical, others are exceedingly so, and some are simply experiments that we\u2019d love to see others push to new heights.<\/p>\n<h2><a id=\"1_Create_highly_disposable_devtesting_environments_6\"><\/a>1. Create highly disposable dev\/testing environments<\/h2>\n<p>We know that many SSD Nodes customers use their VPSs as a place to test software and learn new things in a clean environment that won\u2019t mess up their main machine. A VPS is a pretty cheap and effective educational tool if someone wants to know more about Linux administration or the fundamentals of deploying code to a production server.<\/p>\n<p>But it can also be a pain to repeatedly rebuild your VPS and start clean because, while experimenting, you made some change that breaks everything. Instead, why not use Docker to create a highly disposable, isolated environment to play around in?<\/p>\n<p>Take the <code>xeyes<\/code> Dockerfile from above and expand it until you\u2019ve created a development environment that\u2019s to your exacting standards. Choose the base OS, the software you want to install (<code>vim<\/code> or <code>emacs<\/code> or <code>nano<\/code>, anyone?), and build the image with <code>docker build -t mydev<\/code>, replacing <code>mydev<\/code> with any name you\u2019d like. Then, you can spin up as many instances as you want with <code>docker run -it mydev<\/code>, which will kick you right into a shell to get started.<\/p>\n<p>If something goes terribly wrong inside the container, simply disconnect and destroy it.<\/p>\n<h2><a id=\"2_Run_Docker_inside_of_Docker_16\"><\/a>2. Run Docker inside of Docker<\/h2>\n<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th><img decoding=\"async\" title=\"A visualization of dind, courtesy of J\u00e9r\u00f4me Petazzoni\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2024\/01\/20170531_dind.jpg\" alt=\"A visualization of dind, courtesy of J\u00e9r\u00f4me Petazzoni\" \/><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><em>A visualization of dind, courtesy of J\u00e9r\u00f4me Petazzoni<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Thanks to J\u00e9r\u00f4me Petazzoni, a senior engineer at Docker, it\u2019s <a href=\"https:\/\/docker.com\/2013\/09\/docker-can-now-run-within-docker\/\" target=\"_blank\" rel=\"noopener\">possible to run a Docker container <em>inside<\/em> of another Docker container<\/a>. Even after about 4 years, there\u2019s still very few good reasons for why you would want to do this, except to say that you you did, although some seem to have experimented with running a container for a CI system like Jenkins, which spawns yet more containers.<\/p>\n<p>Check out the <a href=\"http:\/\/docker.com\/2013\/09\/docker-can-now-run-within-docker\/\" target=\"_blank\" rel=\"noopener\">dind repository<\/a> for more information. Or, just run a single command to get nesting:<\/p>\n<pre><code class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\"> docker run --privileged <span class=\"hljs-_\">-d<\/span> docker:dind<\/span>\n<\/code><\/pre>\n<h2><a id=\"3_Containerize_desktop_apps_30\"><\/a>3. Containerize desktop apps<\/h2>\n<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th><img decoding=\"async\" title=\"xeyes through Docker through X11\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2017\/05\/20170531_xeyes2.jpg\" alt=\"xeyes through Docker through X11\" \/><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><em>xeyes through Docker through X11<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Remember that tutorial we put together a few weeks ago about <a href=\"https:\/\/www.ssdnodes.com\/blog\/remote-linux-desktop-vps-ssh-vnc\/\">running GUI applications on your VPS via X11 forwarding<\/a>? Well, it\u2019s possible to also forward X11 applications that are running inside a Docker container, thanks to some enterprising work by <a href=\"https:\/\/dzone.com\/articles\/docker-x11-client-via-ssh\" target=\"_blank\" rel=\"noopener\">Alan Hohn at DZone<\/a>.<\/p>\n<p>First, remember to connect to your VPS using the <code>-XC<\/code> options for <code>ssh<\/code>, and then create a new directory, and a <code>Dockerfile<\/code> inside of it. This assumes you\u2019ve also enabled X11Forwarding\u2014more on that in the link above.<\/p>\n<pre><code class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\"> ssh -XC USER@YOUR-SERVER-IP<\/span>\n<span class=\"hljs-meta\">$<\/span><span class=\"bash\"> mkdir xeyes &amp;&amp; <span class=\"hljs-built_in\">cd<\/span> xeyes<\/span>\n<span class=\"hljs-meta\">$<\/span><span class=\"bash\"> nano Dockerfile<\/span>\n<\/code><\/pre>\n<p>This is a very basic Dockerfile that will create a Docker image called <code>xeyes<\/code> that contains only the bare essentials for running the command.<\/p>\n<pre><code class=\"hljs nginx\"><span class=\"hljs-attribute\">FROM<\/span> centos\nRUN yum install -y xeyes\nCMD [<span class=\"hljs-string\">\"\/usr\/bin\/xeyes\"<\/span>]\n<\/code><\/pre>\n<p>Then, you can build the Docker image.<\/p>\n<pre><code class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\"> docker build -t xeyes .<\/span>\n<\/code><\/pre>\n<p>Finally, give it a whirl. <code>xeyes<\/code> should appear on your local desktop.<\/p>\n<pre><code class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\"> docker run --net=host --env=<span class=\"hljs-string\">\"DISPLAY\"<\/span> --volume=<span class=\"hljs-string\">\"<span class=\"hljs-variable\">$HOME<\/span>\/.Xauthority:\/root\/.Xauthority:rw\"<\/span> xeyes<\/span>\n<\/code><\/pre>\n<p>It <em>should<\/em> be possible to run more complex GUI applications via Docker, but I was unable to get much of anything working right off the bat. Still an interesting thing to experiment with, perhaps.<\/p>\n<h2><a id=\"4_Monitor_Docker_with_Docker_68\"><\/a>4. Monitor Docker with Docker<\/h2>\n<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th><img decoding=\"async\" title=\"The docker-mon interface\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2017\/05\/20170531_docker-mon.png\" alt=\"The docker-mon interface\" \/><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><em>The docker-mon interface<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>So, even if you don\u2019t want into Russian doll territory by running containers inside of containers, you can still leverage the power of Docker to keep tabs on <em>other<\/em> containerized software thanks to <a href=\"http:\/\/dillinger.io\/docker-mon\" target=\"_blank\" rel=\"noopener\"><code>docker-mon<\/code><\/a>.<\/p>\n<p>This application, which can be installed in a single command using Docker itself\u2014<code>docker run -ti -v \/var\/run\/docker.sock:\/var\/run\/docker.sock icecrime\/docker-mon<\/code>\u2014lets you scroll through a list of currently running containers, and then offers a live view into the CPU\/memory\/network usage. Detailed information about the container configuration can help you debug issues or easily discover information you need elsewhere.<\/p>\n<h2><a id=\"5_Monitor_Docker_with__Minecraft__78\"><\/a>5. Monitor Docker with <em>Minecraft<\/em>?<\/h2>\n<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th><img decoding=\"async\" title=\"Stopping, destroying, and starting containers with Minecraft\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2017\/05\/20170531_dockercraft.gif\" alt=\"Stopping, destroying, and starting containers with Minecraft\" \/><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><em>Stopping, destroying, and starting containers with Minecraft<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>That famous 3D interface from the original <em>Jurassic Park<\/em> has finally met its match. Thank Docker itself for creating this oddity of a visualization and management tool for Docker containers. Inside of the Minecraft world, you can start and stop containers with the flip of a switch, destroy them, and start up new ones using the command line.<\/p>\n<p>It\u2019s certainly not practical, but, like most things Docker-related, it\u2019s pretty easy to install and get running. Head on over to the <a href=\"https:\/\/github.com\/docker\/dockercraft\" target=\"_blank\" rel=\"noopener\">Github repository<\/a> to learn more.<\/p>\n<h2><a id=\"Even_more_cool_useful_and_strange_Docker_uses_88\"><\/a>Even more cool, useful, and strange Docker uses<\/h2>\n<p>If you\u2019re looking for more, check out the <a href=\"https:\/\/github.com\/veggiemonk\/awesome-docker\" target=\"_blank\" rel=\"noopener\">awesome-docker repository<\/a> on Github, which contains a list of Docker-based tools and potential use cases broken down by category. We\u2019d also love to hear about what our preview customers have gotten up to over the long weekend\u2014what\u2019s your favorite feature, or your favorite new tool? Let us know in the comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker is a wildly flexible, wildly fun piece of software. Here&#8217;s some of our favorite uses for Docker and a VPS, like using Minecraft for sysadmin tasks.<\/p>\n","protected":false},"author":20,"featured_media":2918,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[18],"tags":[182],"class_list":["post-82","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-docker"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":3,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":12983,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/82\/revisions\/12983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media\/2918"}],"wp:attachment":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}