1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Rewrite the mac and windows docs to use the boot2docker installers.

Docker-DCO-1.1-Signed-off-by: SvenDowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
This commit is contained in:
SvenDowideit 2014-05-26 11:52:57 +10:00
parent e5ba9f6443
commit 5f5d66ade6
5 changed files with 86 additions and 209 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View file

@ -13,174 +13,70 @@ page_keywords: Docker, Docker documentation, requirements, boot2docker, VirtualB
> **Note:**
> Docker is supported on Mac OS X 10.6 "Snow Leopard" or newer.
Docker has two key components: the Docker daemon and the `docker` binary
which acts as a client. The client passes instructions to the daemon
which builds, runs and manages your Docker containers. As Docker uses
some Linux-specific kernel features you can't use it directly on OS X.
Instead we run the Docker daemon inside a lightweight virtual machine on your local
OS X host. We can then use a native client `docker` binary to communicate
with the Docker daemon inside our virtual machine. To make this process
easier we've designed a helper application called
[boot2docker](https://github.com/boot2docker/boot2docker) to install
that virtual machine and run our Docker daemon.
The Docker Engine uses Linux-specific kernel features, so we run it on OS X
using a lightweight virtual machine. You can use the OS X Docker client to
control the virtualized engine to build, run and manage Docker containers.
[boot2docker](https://github.com/boot2docker/boot2docker) uses
VirtualBox to create the virtual machine so we'll need to install that
first.
To make this process easier we designed a helper application called
[boot2docker](https://github.com/boot2docker/boot2docker) to install the
virtual machine and run the Docker daemon.
## Installing VirtualBox
## Installation
Docker on OS X needs VirtualBox to run. To begin with, head over to
[VirtualBox Download Page](https://www.virtualbox.org/wiki/Downloads)
and get the tool for `OS X hosts x86/amd64`.
1. Download the latest release of the [Docker for OSX Installer](
https://github.com/boot2docker/osx-installer/releases)
2. Run the installer, which will install VirtualBox and the Boot2Docker management
tool.
![](/installation/images/osx-installer.png)
3. Open a terminal and run:
Once the download is complete, open the disk image, run `VirtualBox.pkg`
and install VirtualBox.
```
boot2docker init
boot2docker start
export DOCKER_HOST=tcp://localhost:4243
```
> **Note**:
> Do not simply copy the package without running the
> installer.
`boot2docker init` will ask you to enter an ssh key passphrase - the simplest
(but least secure) is to just hit [Enter]. This passphrase is used by the
`boot2docker ssh` command.
## Installing boot2docker manually
### Downloading the boot2docker script
Once you have an initialized virtual machine, you can `boot2docker stop` and
`boot2docker start` it.
[boot2docker](https://github.com/boot2docker/boot2docker) provides a
handy script to manage the VM running the Docker daemon. It also takes
care of the installation of that VM.
## Upgrading
Open up a new terminal window and run the following commands to get
boot2docker:
To upgrade:
# Enter the installation directory
$ mkdir -p ~/bin
$ cd ~/bin
1. Download the latest release of the [Docker for OSX Installer](
https://github.com/boot2docker/osx-installer/releases)
2. Run the installer, which will update VirtualBox and the Boot2Docker management
tool.
3. To upgrade your existing virtual machine, open a terminal and run:
# Get the file
$ curl https://raw.githubusercontent.com/boot2docker/boot2docker/master/boot2docker > boot2docker
```
boot2docker stop
boot2docker download
boot2docker start
```
# Mark it executable
$ chmod +x boot2docker
### Installing the Docker OS X Client
## Running Docker
The Docker daemon is accessed using the `docker` binary.
From your terminal, you can try the “hello world” example. Run:
Run the following commands to get it downloaded and set up:
$ docker run ubuntu echo hello world
# Get the docker binary
$ DIR=$(mktemp -d ${TMPDIR:-/tmp}/dockerdl.XXXXXXX) && \
curl -f -o $DIR/ld.tgz https://get.docker.io/builds/Darwin/x86_64/docker-latest.tgz && \
gunzip $DIR/ld.tgz && \
tar xvf $DIR/ld.tar -C $DIR/ && \
cp $DIR/usr/local/bin/docker ./docker
This will download the ubuntu image and print hello world.
# Copy the executable file
$ sudo mkdir -p /usr/local/bin
$ sudo cp docker /usr/local/bin/
# Further details
### Configure the Docker OS X Client
The Boot2Docker management tool provides some commands:
The Docker client, `docker`, uses an environment variable `DOCKER_HOST`
to specify the location of the Docker daemon to connect to. Specify your
local boot2docker virtual machine as the value of that variable.
```
$ ./boot2docker
Usage: ./boot2docker [<options>] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|delete|download|version} [<args>]
```
$ export DOCKER_HOST=tcp://127.0.0.1:4243
## Installing boot2docker with Homebrew
If you are using Homebrew on your machine, simply run the following
command to install `boot2docker`:
$ brew install boot2docker
Run the following command to install the Docker client:
$ brew install docker
And that's it! Let's check out how to use it.
# How To Use Docker On Mac OS X
## Running the Docker daemon via boot2docker
Firstly we need to initialize our boot2docker virtual machine. Run the
`boot2docker` command.
$ boot2docker init
This will setup our initial virtual machine.
Next we need to start the Docker daemon.
$ boot2docker up
There are a variety of others commands available using the `boot2docker`
script. You can see these like so:
$ boot2docker
Usage ./boot2docker {init|start|up|pause|stop|restart|status|info|delete|ssh|download}
## The Docker client
Once the virtual machine with the Docker daemon is up, you can use the `docker`
binary just like any other application.
$ docker version
Client version: 0.10.0
Client API version: 1.10
Server version: 0.10.0
Server API version: 1.10
Last stable version: 0.10.0
## Using Docker port forwarding with boot2docker
In order to forward network ports from Docker with boot2docker we need to
manually forward the port range Docker uses inside VirtualBox. To do
this we take the port range that Docker uses by default with the `-P`
option, ports 49000-49900, and run the following command.
> **Note:**
> The boot2docker virtual machine must be powered off for this
> to work.
for i in {49000..49900}; do
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i";
VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,udp,,$i,,$i";
done
## Connecting to the VM via SSH
If you feel the need to connect to the VM, you can simply run:
$ boot2docker ssh
# User: docker
# Pwd: tcuser
If SSH complains about keys then run:
$ ssh-keygen -R '[localhost]:2022'
## Upgrading to a newer release of boot2docker
To upgrade an initialized boot2docker virtual machine, you can use the
following 3 commands. Your virtual machine's disk will not be changed,
so you won't lose your images and containers:
$ boot2docker stop
$ boot2docker download
$ boot2docker start
# Learn More
## boot2docker
See the GitHub page for
[boot2docker](https://github.com/boot2docker/boot2docker).
# Next steps
You can now continue with the [*Hello
World*](/examples/hello_world/#hello-world) example.
For further information or to report issues, please see the [Boot2Docker site](http://boot2docker.io).

View file

@ -1,56 +1,57 @@
page_title: Installation on Windows
page_description: Please note this project is currently under heavy development. It should not be used in production.
page_description: Docker installation on Microsoft Windows
page_keywords: Docker, Docker documentation, Windows, requirements, virtualbox, boot2docker
# Windows
Docker can run on Windows using a virtualization platform like
VirtualBox. A Linux distribution is run inside a virtual machine and
that's where Docker will run.
## Installation
> **Note**:
> Docker is still under heavy development! We don't recommend using it in
> production yet, but we're getting closer with each release. Please see
> our blog post, [Getting to Docker 1.0](
> http://blog.docker.io/2013/08/getting-to-docker-1-0/)
1. Install virtualbox from [https://www.virtualbox.org](
https://www.virtualbox.org) - or follow this [tutorial](
http://www.slideshare.net/julienbarbier42/install-virtualbox-on-windows-7).
2. Download the latest boot2docker.iso from
[https://github.com/boot2docker/boot2docker/releases](
https://github.com/boot2docker/boot2docker/releases).
3. Start VirtualBox.
4. Create a new Virtual machine with the following settings:
Docker Engine runs on Windows using a lightweight virtual machine. There
is no native Windows Docker client yet, so everything is done inside the virtual
machine.
- Name: boot2docker
- Type: Linux
- Version: Linux 2.6 (64 bit)
- Memory size: 1024 MB
- Hard drive: Do not add a virtual hard drive
To make this process easier we designed a helper application called
[boot2docker](https://github.com/boot2docker/boot2docker) to install the
virtual machine and run the Docker daemon.
5. Open the settings of the virtual machine:
5.1. go to Storage
5.2. click the empty slot below Controller: IDE
5.3. click the disc icon on the right of IDE Secondary Master
5.4. click Choose a virtual CD/DVD disk file
## Installation
6. Browse to the path where you`ve saved the boot2docker.iso, select
the boot2docker.iso and click open.
1. Download the latest release of the [Docker for Windows Installer](https://github.com/boot2docker/windows-installer/releases)
2. Run the installer, which will install VirtualBox, MSYS-git, the boot2docker Linux ISO and the
Boot2Docker management tool.
![](/installation/images/windows-installer.png)
3. Run the `Boot2Docker Start` shell script from your Desktop or Program Files > Docker.
The Start script will ask you to enter an ssh key passphrase - the simplest
(but least secure) is to just hit [Enter].
![](/installation/images/windows-boot2docker-start.png)
7. Click OK on the Settings dialog to save the changes and close the
window.
The `Boot2Docker Start` script will connect you to a shell session in the virtual
Machine. If needed, it will initialise a new VM and start it.
8. Start the virtual machine by clicking the green start button.
## Upgrading
To upgrade:
1. Download the latest release of the [Docker for Windows Installer](
https://github.com/boot2docker/windows-installer/releases)
2. Run the installer, which will update the Boot2Docker management tool.
3. To upgrade your existing virtual machine, open a terminal and run:
```
boot2docker stop
boot2docker download
boot2docker start
```
9. The boot2docker virtual machine should boot now.
## Running Docker
boot2docker will log you in automatically so you can start using Docker
Boot2Docker will log you in automatically so you can start using Docker
right away.
Let's try the “hello world” example. Run
@ -59,34 +60,14 @@ Let's try the “hello world” example. Run
This will download the small busybox image and print hello world.
## Persistent storage
# Further Details
1. Add a virtual hard drive to the VM created in Installation
2. Start the VM
3. Create an empty partition on the attached virtual hard drive
The Boot2Docker management tool provides some commands:
```sh
sudo fdisk /dev/sda
n (new partition)
p (primary partition)
1 (partition 1)
w (write changes to disk)
```
```
$ ./boot2docker
Usage: ./boot2docker [<options>] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|delete|download|version} [<args>]
```
4. Format the partition using ext4
```sh
mkfs.ext4 -L boot2docker-data /dev/sda1
```
5. Reboot
```sh
sudo reboot
```
6. boot2docker should now auto mount the partition and persist data there. (/var/lib/docker linking to /mnt/sda1/var/lib/docker)
```sh
ls -l /var/lib
```
For further information or to report issues, please see the [Boot2Docker site](http://boot2docker.io)