27
Run Docker on Windows using Vagrant Contents Install VirtualBox on Windows........................................2 Install Vagrant on Windows........................................... 7 Install Git (with SSH) on Windows...................................12 Run Docker on Windows using VirtualBox and Vagrant..................18 Opening the command prompt.........................................18 Launch an Ubuntu virtual server....................................18 Log onto your Ubuntu server........................................19 Using Vagrant on Windows Command Prompt..........................20 Using SSH........................................................20 Running docker.....................................................23 http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using- vagrant

Run Docker On Windows Using Vagrant

Embed Size (px)

DESCRIPTION

Tutorial on How to Run Docker On Windows Using Vagrant

Citation preview

Page 1: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

ContentsInstall VirtualBox on Windows.....................................................................................................................2

Install Vagrant on Windows.........................................................................................................................7

Install Git (with SSH) on Windows.............................................................................................................12

Run Docker on Windows using VirtualBox and Vagrant............................................................................18

Opening the command prompt.............................................................................................................18

Launch an Ubuntu virtual server...........................................................................................................18

Log onto your Ubuntu server.................................................................................................................19

Using Vagrant on Windows Command Prompt.................................................................................20

Using SSH...........................................................................................................................................20

Running docker......................................................................................................................................23

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 2: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Install VirtualBox on Windows

VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop and embedded use. VirtualBox can be downloaded from https://www.virtualbox.org/wiki/Downloads

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 3: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

At this point you should have a .exe file in your download directory.

Double click on it to launch the installation, and follow the steps.

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 4: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 5: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 6: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

From this point you will get some Windows security boxes popping up to ask you confirmation to install device software. Click the “install” button for all of these.

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 7: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 8: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Install Vagrant on Windows

Vagrant gives you a disposable environment and consistent workflow for developing and testing infrastructure management scripts. You can download and install the latest version of Vagrant from http://downloads.vagrantup.com/

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 9: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Choose the lastest version, and since we are working on windows, chose the .msi file.

You should now have a .msi file in your download directory.

Double click on it to launch the installation and follow the steps.

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 10: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 11: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 12: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 13: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Install Git (with SSH) on Windows

You can download and install the latest version of Git from http://git-scm.com/downloads

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 14: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Launch the setup wizard and follow the steps:

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 15: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 16: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 17: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 18: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 19: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Run Docker on Windows using VirtualBox and Vagrant

Opening the command prompt

First open a cmd prompt. Press Windows key and then press “R” key. This will open the RUN dialog box for you. Type “cmd” and press Enter. Or you can click on Start, type “cmd” in the “Search programs and files” field, and click on cmd.exe.

This should open a cmd prompt window.

Alternatively, you can also use a Cygwin terminal, or Git Bash (or any other command line program you are usually using). The next steps would be the same.

Launch an Ubuntu virtual server

Let’s download and run an Ubuntu image with docker binaries already installed.

git clone https://github.com/dotcloud/docker.gitcd dockervagrant up

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 20: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Congratulations! You are running an Ubuntu server with docker installed on it. You do not see it though, because it is running in the background.

Log onto your Ubuntu server

Let’s log into your Ubuntu server now. To do so you have two choices

1. Using Vagrant on Windows command prompt2. Using SSH directly

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 21: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Using Vagrant on Windows Command Prompt

Run the following command

vagrant ssh

You may see an error message starting with “`ssh` executable not found”. In this case it means that you do not have SSH in your PATH. If you do not have SSH in your PATH you can set it up with the “set” command. For instance, if your ssh.exe is in the folder named “C:\Program Files (x86)\Git\bin”, then you can run the following command:

set PATH=%PATH%;C:\Program Files (x86)\Git\bin

Using SSH

First step is to get the IP and port of your Ubuntu server. Simply run

vagrant ssh-config

You should see an output with HostName and Port information. In this example, HostName is 127.0.0.1 and port is 2222. And the User is “vagrant”. The password is not shown, but it is also “vagrant”.

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 22: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

You can now use this information for connecting via SSH to your server. To do so you can:

1. Use putty.exe2. Run SSH from a terminal

Use putty.exe

You can download putty.exe from this page http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Launch putty.exe and simply enter the information you got from last step.

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 23: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Open, and enter user = vagrant and password = vagrant.

SSH from a terminal

You can also run this command on your favorite terminal (windows prompt, cygwin, git-bash, …). Make sure to adapt the IP and port from what you got from the vagrant ssh-config command.

ssh [email protected] –p 2222

Enter user = vagrant and password = vagrant.

Congratulations, you are now logged onto your Ubuntu Server, running on top of your Windows machine !

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant

Page 24: Run Docker On Windows Using Vagrant

Run Docker on Windows using Vagrant

Running docker

First you have to be root in order to run docker. Simply run the following command:

sudo su

You are now ready for the docker’s “hello world” example. Run

docker run -a busybox echo hello world

All done!

http://www.slideshare.net/julienbarbier42/run-docker-on-windows-using-vagrant