Skip to content

Instantly share code, notes, and snippets.

@whyvez
Last active March 24, 2016 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whyvez/b3682ee71c31a7d9937c to your computer and use it in GitHub Desktop.
Save whyvez/b3682ee71c31a7d9937c to your computer and use it in GitHub Desktop.
Linux on Windows in 5 minutes flat.

###TL;DR

  1. Install the Docker Toolbox from : https://www.docker.com/toolbox
  2. Open on the Github Terminal application (CLI).
  3. Run these commands at the CLI.
docker-machine create --driver virtualbox --virtualbox-host-dns-resolver default
docker-machine env --shell powershell default | Invoke-Expression
docker run -ti debian /bin/bash

###Long Form

  1. Install the Docker toolbox following these instructions.
  2. We will use the Github Terminal Icon installed as part of the Github Install for our CLI. i.e. Powershell
  3. The 3rd line above creates a virtual machine with the name defaul.
  4. The 4th line above sources the default VM into your environment so the docker client can connect to the vm/host.
  5. The 5th line above runs an image and creates a container. The image is downloaded from DockerHub and ran locally. The -ti option tells docker that you want to run this container interactively. The /bin/bash argument tell the doecker you want to land on the shell; bash in this case.

###Advanced Uses

####Where's my data?

Sometimes you need to run some analysis on data and you need access to is within your container. You can easily do this using docker volumes.

docker run -ti -v ./data:/opt/data -w /opt/data debian /bin/bash
  • -v => local-path:container-path : maps the local path to the container path.
  • -w => set the working directory of the container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment