2013-05-21 13:47:16 -04:00
|
|
|
:title: Using Vagrant (Mac, Linux)
|
|
|
|
:description: This guide will setup a new virtualbox virtual machine with docker installed on your computer.
|
|
|
|
:keywords: Docker, Docker documentation, virtualbox, vagrant, git, ssh, putty, cygwin
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-08-27 17:29:49 -04:00
|
|
|
.. _install_using_vagrant:
|
|
|
|
|
2013-05-15 19:11:59 -04:00
|
|
|
Using Vagrant (Mac, Linux)
|
|
|
|
==========================
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-08-28 20:26:10 -04:00
|
|
|
This guide will setup a new virtualbox virtual machine with docker
|
|
|
|
installed on your computer. This works on most operating systems,
|
|
|
|
including MacOX, Windows, Linux, FreeBSD and others. If you can
|
2013-09-05 04:40:11 -04:00
|
|
|
install these and have at least 400MB RAM to spare you should be good.
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-04-22 16:10:32 -04:00
|
|
|
Install Vagrant and Virtualbox
|
|
|
|
------------------------------
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-08-28 20:26:10 -04:00
|
|
|
.. include:: install_header.inc
|
|
|
|
|
|
|
|
.. include:: install_unofficial.inc
|
|
|
|
|
|
|
|
#. Install virtualbox from https://www.virtualbox.org/ (or use your
|
|
|
|
package manager)
|
|
|
|
#. Install vagrant from http://www.vagrantup.com/ (or use your package
|
|
|
|
manager)
|
|
|
|
#. Install git if you had not installed it before, check if it is
|
|
|
|
installed by running ``git`` in a terminal window
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
|
|
|
2013-04-22 21:38:42 -04:00
|
|
|
Spin it up
|
|
|
|
----------
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-08-28 20:26:10 -04:00
|
|
|
1. Fetch the docker sources (this includes the ``Vagrantfile`` for
|
|
|
|
machine setup).
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-04-23 15:04:53 -04:00
|
|
|
.. code-block:: bash
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-04-23 15:04:53 -04:00
|
|
|
git clone https://github.com/dotcloud/docker.git
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-09-04 20:47:18 -04:00
|
|
|
2. Change directory to docker
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
cd docker
|
|
|
|
|
|
|
|
3. Run vagrant from the sources directory
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-04-23 15:04:53 -04:00
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
vagrant up
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-04-23 15:04:53 -04:00
|
|
|
Vagrant will:
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-04-23 15:04:53 -04:00
|
|
|
* Download the 'official' Precise64 base ubuntu virtual machine image from vagrantup.com
|
|
|
|
* Boot this image in virtualbox
|
|
|
|
* Add the `Docker PPA sources <https://launchpad.net/~dotcloud/+archive/lxc-docker>`_ to /etc/apt/sources.lst
|
|
|
|
* Update your sources
|
|
|
|
* Install lxc-docker
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-04-23 15:04:53 -04:00
|
|
|
You now have a Ubuntu Virtual Machine running with docker pre-installed.
|
2013-04-19 23:57:50 -04:00
|
|
|
|
2013-04-23 15:04:53 -04:00
|
|
|
Connect
|
|
|
|
-------
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
|
|
To access the VM and use Docker, Run ``vagrant ssh`` from the same directory as where you ran
|
2013-04-22 16:10:32 -04:00
|
|
|
``vagrant up``. Vagrant will connect you to the correct VM.
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2013-04-23 15:04:53 -04:00
|
|
|
vagrant ssh
|
|
|
|
|
|
|
|
Run
|
|
|
|
-----
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
|
|
Now you are in the VM, run docker
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2013-08-13 21:05:35 -04:00
|
|
|
sudo docker
|
2013-04-23 15:04:53 -04:00
|
|
|
|
2013-04-19 23:57:50 -04:00
|
|
|
|
|
|
|
Continue with the :ref:`hello_world` example.
|