This commit is contained in:
Caleb Spare 2013-03-21 18:18:34 -07:00
Родитель 3aefed2dc2
Коммит 7566006d0d
1 изменённых файлов: 39 добавлений и 39 удалений

Просмотреть файл

@ -59,8 +59,8 @@ Installing on Ubuntu 12.04 and 12.10
1. Install dependencies: 1. Install dependencies:
```bash ```bash
sudo apt-get install lxc wget bsdtar curl sudo apt-get install lxc wget bsdtar curl
sudo apt-get install linux-image-extra-`uname -r` sudo apt-get install linux-image-extra-`uname -r`
``` ```
The `linux-image-extra` package is needed on standard Ubuntu EC2 AMIs in order to install the aufs kernel module. The `linux-image-extra` package is needed on standard Ubuntu EC2 AMIs in order to install the aufs kernel module.
@ -68,15 +68,15 @@ The `linux-image-extra` package is needed on standard Ubuntu EC2 AMIs in order t
2. Install the latest docker binary: 2. Install the latest docker binary:
```bash ```bash
wget http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz wget http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz
tar -xf docker-master.tgz tar -xf docker-master.tgz
``` ```
3. Run your first container! 3. Run your first container!
```bash ```bash
cd docker-master cd docker-master
sudo ./docker run -a -i -t base /bin/bash sudo ./docker run -a -i -t base /bin/bash
``` ```
Consider adding docker to your `PATH` for simplicity. Consider adding docker to your `PATH` for simplicity.
@ -99,12 +99,12 @@ with VirtualBox as well as on Amazon EC2. Vagrant 1.1 is required for
EC2, but deploying is as simple as: EC2, but deploying is as simple as:
```bash ```bash
$ export AWS_ACCESS_KEY_ID=xxx \ $ export AWS_ACCESS_KEY_ID=xxx \
AWS_SECRET_ACCESS_KEY=xxx \ AWS_SECRET_ACCESS_KEY=xxx \
AWS_KEYPAIR_NAME=xxx \ AWS_KEYPAIR_NAME=xxx \
AWS_SSH_PRIVKEY=xxx AWS_SSH_PRIVKEY=xxx
$ vagrant plugin install vagrant-aws $ vagrant plugin install vagrant-aws
$ vagrant up --provider=aws $ vagrant up --provider=aws
``` ```
The environment variables are: The environment variables are:
@ -115,11 +115,11 @@ The environment variables are:
* `AWS_SSH_PRIVKEY` - The path to the private key for the named keypair * `AWS_SSH_PRIVKEY` - The path to the private key for the named keypair
For VirtualBox, you can simply ignore setting any of the environment For VirtualBox, you can simply ignore setting any of the environment
variables and omit the ``provider`` flag. VirtualBox is still supported with variables and omit the `provider` flag. VirtualBox is still supported with
Vagrant <= 1.1: Vagrant &lt;= 1.1:
```bash ```bash
$ vagrant up $ vagrant up
``` ```
@ -131,12 +131,12 @@ Running an interactive shell
---------------------------- ----------------------------
```bash ```bash
# Download a base image # Download a base image
docker import base docker import base
# Run an interactive shell in the base image, # Run an interactive shell in the base image,
# allocate a tty, attach stdin and stdout # allocate a tty, attach stdin and stdout
docker run -a -i -t base /bin/bash docker run -a -i -t base /bin/bash
``` ```
@ -144,17 +144,17 @@ Starting a long-running worker process
-------------------------------------- --------------------------------------
```bash ```bash
# Run docker in daemon mode # Run docker in daemon mode
(docker -d || echo "Docker daemon already running") & (docker -d || echo "Docker daemon already running") &
# Start a very useful long-running process # Start a very useful long-running process
JOB=$(docker run base /bin/sh -c "while true; do echo Hello world; sleep 1; done") JOB=$(docker run base /bin/sh -c "while true; do echo Hello world; sleep 1; done")
# Collect the output of the job so far # Collect the output of the job so far
docker logs $JOB docker logs $JOB
# Kill the job # Kill the job
docker kill $JOB docker kill $JOB
``` ```
@ -162,7 +162,7 @@ Listing all running containers
------------------------------ ------------------------------
```bash ```bash
docker ps docker ps
``` ```
@ -170,17 +170,17 @@ Expose a service on a TCP port
------------------------------ ------------------------------
```bash ```bash
# Expose port 4444 of this container, and tell netcat to listen on it # Expose port 4444 of this container, and tell netcat to listen on it
JOB=$(docker run -p 4444 base /bin/nc -l -p 4444) JOB=$(docker run -p 4444 base /bin/nc -l -p 4444)
# Which public port is NATed to my container? # Which public port is NATed to my container?
PORT=$(docker port $JOB 4444) PORT=$(docker port $JOB 4444)
# Connect to the public port via the host's public address # Connect to the public port via the host's public address
echo hello world | nc $(hostname) $PORT echo hello world | nc $(hostname) $PORT
# Verify that the network connection worked # Verify that the network connection worked
echo "Daemon received: $(docker logs $JOB)" echo "Daemon received: $(docker logs $JOB)"
``` ```
Contributing to Docker Contributing to Docker
@ -226,7 +226,7 @@ Setting up a dev environment
Instructions that is verified to work on Ubuntu 12.10, Instructions that is verified to work on Ubuntu 12.10,
``` ```bash
sudo apt-get -y install lxc wget bsdtar curl libsqlite3-dev golang git pkg-config sudo apt-get -y install lxc wget bsdtar curl libsqlite3-dev golang git pkg-config
export GOPATH=~/go/ export GOPATH=~/go/
@ -243,7 +243,7 @@ go install -v github.com/dotcloud/docker/...
Then run the docker daemon, Then run the docker daemon,
``` ```bash
sudo $GOPATH/bin/docker -d sudo $GOPATH/bin/docker -d
``` ```