Cloudshare Logo
  • Solutions
    • Hands-on Training
      • Instructor-led Training
      • Self-paced Training
      • Software Training on Public Cloud
      • Events
      • Technical Certifications
    • Sales Enablement
      • Sales Demos
      • POCs
      • Sales Demos & POCs on Public Cloud
      • Self Service Trials
    • MORE USE CASES
      • Channels
      • Support
      • Sandboxing
      • Cybersecurity
  • Learn
    • Technology
      • Infrastructure
      • Virtual Labs
    • Integrations
      • CRM
      • LMS
      • SSO
      • REST API
    • Resources
      • Case Studies
      • eBooks
      • Webinars
      • White Papers
      • Brochures
      • Videos
      • Software Training Budget Calculator
    • Virtual Labs Glossary
      • Virtual Training Resources
      • Sales Enablement Resources
      • Sales Engineer Resources
      • Virtual Labs for AWS
      • Virtual Labs for Microsoft Azure
      • Virtual Labs for Google Cloud
  • Company
    • placeholder
      • About Us
      • Executive Team
      • Board
      • Media & News
    • placeholder
      • Press Releases
      • Careers
      • Community Login
  • Blog
  • Pricing
  • Login
  • Book a Demo
Book a Demo

Using Docker-Machine with CloudShare

To get articles like this free in your inbox, subscribe to our newsletter.

By Assaf Lavie - Feb 23, 2017 / Thought Leadership

Docker-Machine lets you run Docker commands on remote hosts. It integrates with all the popular cloud providers, and as of today, this includes CloudShare.

Docker-Machine?

Yes, Docker-Machine. You know – that thing everyone used for a while to run Docker on Macs, before Docker for Mac was released? It is a tremendously useful and underappreciated part of the Docker tool chain.

Here’s what Docker-Machine does for you.

Docker-Engine (the bit that actually runs the containers) is actually an HTTP API server. When you do something like docker container ls, for example, the CLI application sends a HTTP GET /containers/json request to get you the data. Now, typically this happens locally, on a unix socket. But the Docker-Engine daemon can happily listen on a TCP socket as well, accepting requests from remote machines. The DOCKER_HOST env-var tells the CLI which Docker-Engine daemon it should use.

Thus, if you want to run Docker commands on a remote machine, you can. But you need to set the right env-vars, make sure the right Docker-Engine version is available on the remote machine, and perform authentication – a bunch of stuff, I know, but this is exactly the hassle Docker-Machine eliminates for you.

Remote Docker

Let’s say you have a Dockerized web server (my-node-server) that you wish to run on a remote machine that’s publicly accessible on the web. With Docker-Machine you can do something like:

docker-machine create --driver cloudshare my-server

This creates a remote VM for you, installs Docker on it, and configures authentication. Then you just “activate” it with:

eval $(docker-machine env my-server)

which sets the proper env-vars for you. And that’s it. From that point on any docker command you run happens remotely:

docker run my-node-server

Behind the scenes, CloudShare’s Docker-Machine driver spins up a new environment for you that already has the latest Docker-Engine driver installed.

The Cool Part

When you use CloudShare’s Docker-Machine driver, you get a fresh, disposable VM on which to run containers. This way, your developer machine doesn’t get bogged down and clogged up by all those containers and images.

Each VM runs in its own environment, which you can snapshot, restore and share with others. You can use that to capture the entire machine’s state, for example, if you come across some bug that’s hard to reproduce.

Furthermore, each VM is accessible on the internet and has a fixed public DNS record. If you are serving HTTP, you also get HTTPS termination for free using the web access feature. You could have properly secured HTTPS server online in minutes, without having to mess around with cerficiates.

You can spin up as many of these Docker machines as you need, and with CloudShare’s auto-suspend policies you only pay for actual usage. When a CloudShare docker-machine is docker-idle (without any running containers), it will auto-suspend itself after a while. This is configurable with environment policies, but works well out of the box.

Getting Started

  1. You’ll need to install Docker-Machine.
  2. Download the latest release of the CloudShare driver for Docker-Machine and put the executable (docker-machine-driver-cloudshare) somewhere in your $PATH. It’s written in Go, using our Go SDK, so it’s just a single binary – no other dependencies.

Now try calling:

docker-machine -d cloudshare create --help

If it prints the usage, you’re set.

Usage: docker-machine create [OPTIONS] [arg...]

Create a machine

Description:
   Run 'docker-machine create --driver name' to include the create flags for that driver in the help text.

Options:

   --cloudshare-api-id                                          CloudShare API ID (required) [$CLOUDSHARE_API_ID]
   --cloudshare-api-key                                         CloudShare API KEY (required) [$CLOUDSHARE_API_KEY]
   --cloudshare-cpus "0"                                        CPU count
   --cloudshare-disk-gb "0"                                     Disk size (GB), >=10GB
   --cloudshare-ram-mb "0"                                      RAM (MBs) 256-32768
   --cloudshare-region-name "Miami"                                 CloudShare region name
   --cloudshare-vm-template-id                                      VM Template ID
   --cloudshare-vm-template-name "Docker - Ubuntu 14.04 Server - SMALL"                 VM Template name (exact name; cannot be used with --cloudshare-vm-template-id)
  1. The only required option is the API ID & Key. We recommend you export them as env-vars (CLOUDSHARE_API_ID, CLOUDSHARE_API_KEY) so you don’t have to pass them into each call.

You can now create Docker machines with:

docker-machine create -d cloudshare machine-name

Easy, right? Try doing the same with the amazonec2 Docker-Machine driver and see how long that takes to work? 😉

Getting Fancy

We have a few Docker-ready VM templates you can choose from, with different hardware specs and OS versions.

docker vm templates

By default the driver launches a “small” VM, but you can use --cloudshare-vm-template-name to specify a different template. For example:

docker-machine create -d cloudshare \
    --cloudshare-vm-template-name "Docker - Ubuntu 16.04 Server - LARGE" \
    my-large-machine

You can also tweak the hardware specs yourself (cpus, RAM, disk), but be aware it takes longer to launch customized VMs than when using one of the ready-made templates.

docker machine logo

Read our blog post about Docker 1.13

You may also be interested in reading about:

Jenkins – Build Docker image


What you should do next…

1. Subscribe to our newsletter:

Subscribe to our newsletter below for the latest news, advice and thought-leadership for software professionals. Or visit our blog to browse our most recent articles.

2. Learn how virtual labs can grow your business:

To learn more about how CloudShare helps software organizations grow revenue, increase efficiency and improve quality, visit our resources page. You’ll be able to browser dozens of valuable white papers, eBooks, webinars, case studies, and brochures.

3. Get a FREE, no obligation demo:

Discover just how easy it is to create your cloud environment—in minutes! One of our friendly virtual labs experts will be happy to:

  • Show you the platform in action
  • Calculate pricing for your business
  • Set you up with a 14-day free trial
  • Answer any questions you have
  • No pressure or obligation

GET A FREE DEMO

Subscribe to our newsletter

CloudShare will store and process your personal data as described in our Privacy Policy.  You can opt out at any time.

CloudShare US
691 S. Milpitas Blvd, Suite 212
Milpitas, CA 95035, USA
Contact
CloudShare Israel
7 Jabotinsky St.
Ramat Gan, Israel
Contact
CloudShare Australia
152 St Georges Terrace
Perth, WA, 6000, Australia
Contact
  • Solutions
    • Virtual Training
    • Sales Demos and POCs
    • Support
    • Sandboxing
    • Cybersecurity
  • Technology
    • Overview
    • Infrastructure
    • Virtual Labs
    • Template Library
    • Ravello End of Life
    • Status
  • Training
    • Instructor-led Training
    • Self-paced Training
    • Software Training on Public Cloud
    • Technical Certification Programs
    • Events
    • Customer Education & Training Resources
  • Sales Enablement
    • Sales Demos
    • POCs
    • Sales Demos & POCs on Public Cloud
    • Self Service Trials
    • Sales Enablement Resources
    • Sales Engineer Resources
  • Resources
    • Case Studies
    • eBooks
    • Webinars
    • White Papers
    • Blog
    • Virtual IT Labs Glossary
  • Virtual Labs Blog
    • What to Accomplish in Your First 90 Days As a Director of Sales Engineering
    • Measuring Success Across the Customer Lifecycle: Key Metrics
    • The Top 10 Sales Enablement Podcasts of 2023: Our Full List

Privacy policy|

Careers|

© CloudShare, Inc © 2007-2025

See CloudShare in action

Schedule your free demo now

CloudShare will store and process your personal data as described in our Privacy Policy. You can opt out at any time.