浏览代码

Merge branch 'master' of github.com:dotcloud/docker

shin- 12 年之前
父节点
当前提交
9fa3d891c6
共有 3 个文件被更改,包括 75 次插入60 次删除
  1. 47 47
      README.md
  2. 24 13
      Vagrantfile
  3. 4 0
      docs/README.md

+ 47 - 47
README.md

@@ -58,28 +58,28 @@ Installing on Ubuntu 12.04 and 12.10
 
 
 1. Install dependencies:
 1. Install dependencies:
 
 
-```bash
-        sudo apt-get install lxc wget bsdtar curl
-        sudo apt-get install linux-image-extra-`uname -r`
-```
+    ```bash
+    sudo apt-get install lxc wget bsdtar curl
+    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.
 
 
 2. Install the latest docker binary:
 2. Install the latest docker binary:
 
 
-```bash
-	wget http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz
-	tar -xf docker-master.tgz
-```
+    ```bash
+    wget http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz
+    tar -xf docker-master.tgz
+    ```
 
 
 3. Run your first container!
 3. Run your first container!
 
 
-```bash
-	cd docker-master
-	sudo ./docker run -a -i -t base /bin/bash
-```
+    ```bash
+    cd docker-master
+    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.
 
 
 Installing on other Linux distributions
 Installing on other Linux distributions
 ---------------------------------------
 ---------------------------------------
@@ -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 \
-			AWS_SECRET_ACCESS_KEY=xxx \
-			AWS_KEYPAIR_NAME=xxx \
-			AWS_SSH_PRIVKEY=xxx
-		$ vagrant plugin install vagrant-aws
-		$ vagrant up --provider=aws
+$ export AWS_ACCESS_KEY_ID=xxx \
+	AWS_SECRET_ACCESS_KEY=xxx \
+	AWS_KEYPAIR_NAME=xxx \
+	AWS_SSH_PRIVKEY=xxx
+$ vagrant plugin install vagrant-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
-Vagrant <= 1.1:
+variables and omit the `provider` flag. VirtualBox is still supported with
+Vagrant &lt;= 1.1:
 
 
 ```bash
 ```bash
-		$ vagrant up
+$ vagrant up
 ```
 ```
 
 
 
 
@@ -131,12 +131,12 @@ Running an interactive shell
 ----------------------------
 ----------------------------
 
 
 ```bash
 ```bash
-	# Download a base image
-	docker import base
+# Download a base image
+docker import base
 
 
-	# Run an interactive shell in the base image,
-	# allocate a tty, attach stdin and stdout
-	docker run -a -i -t base /bin/bash
+# Run an interactive shell in the base image,
+# allocate a tty, attach stdin and stdout
+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
-	(docker -d || echo "Docker daemon already running") &
+# Run docker in daemon mode
+(docker -d || echo "Docker daemon already running") &
 
 
-	# Start a very useful long-running process
-	JOB=$(docker run base /bin/sh -c "while true; do echo Hello world; sleep 1; done")
+# Start a very useful long-running process
+JOB=$(docker run base /bin/sh -c "while true; do echo Hello world; sleep 1; done")
 
 
-	# Collect the output of the job so far
-	docker logs $JOB
+# Collect the output of the job so far
+docker logs $JOB
 
 
-	# Kill the job
-	docker kill $JOB
+# Kill the 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
-	JOB=$(docker run -p 4444 base /bin/nc -l -p 4444)
+# Expose port 4444 of this container, and tell netcat to listen on it
+JOB=$(docker run -p 4444 base /bin/nc -l -p 4444)
 
 
-	# Which public port is NATed to my container?
-	PORT=$(docker port $JOB 4444)
+# Which public port is NATed to my container?
+PORT=$(docker port $JOB 4444)
 
 
-	# Connect to the public port via the host's public address
-	echo hello world | nc $(hostname) $PORT
+# Connect to the public port via the host's public address
+echo hello world | nc $(hostname) $PORT
 
 
-	# Verify that the network connection worked
-	echo "Daemon received: $(docker logs $JOB)"
+# Verify that the network connection worked
+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
 ```
 ```
 
 

+ 24 - 13
Vagrantfile

@@ -1,7 +1,7 @@
 # -*- mode: ruby -*-
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 # vi: set ft=ruby :
 
 
-Vagrant.configure("1") do |config|
+def v10(config)
   # All Vagrant configuration is done here. The most common configuration
   # All Vagrant configuration is done here. The most common configuration
   # options are documented and commented below. For a complete reference,
   # options are documented and commented below. For a complete reference,
   # please see the online documentation at vagrantup.com.
   # please see the online documentation at vagrantup.com.
@@ -20,7 +20,7 @@ Vagrant.configure("1") do |config|
   # via the IP. Host-only networks can talk to the host machine as well as
   # via the IP. Host-only networks can talk to the host machine as well as
   # any other machines on the same network, but cannot be accessed (through this
   # any other machines on the same network, but cannot be accessed (through this
   # network interface) by any external networks.
   # network interface) by any external networks.
-  # config.vm.network :hostonly, "192.168.33.10"
+  config.vm.network :hostonly, "192.168.33.10"
 
 
   # Assign this VM to a bridged network, allowing you to connect directly to a
   # Assign this VM to a bridged network, allowing you to connect directly to a
   # network using the host's network device. This makes the VM appear as another
   # network using the host's network device. This makes the VM appear as another
@@ -34,6 +34,9 @@ Vagrant.configure("1") do |config|
   # Share an additional folder to the guest VM. The first argument is
   # Share an additional folder to the guest VM. The first argument is
   # an identifier, the second is the path on the guest to mount the
   # an identifier, the second is the path on the guest to mount the
   # folder, and the third is the path on the host to the actual folder.
   # folder, and the third is the path on the host to the actual folder.
+  if not File.exist? File.expand_path '~/docker'
+    Dir.mkdir(File.expand_path '~/docker')
+  end
   config.vm.share_folder "v-data", "~/docker", "~/docker"
   config.vm.share_folder "v-data", "~/docker", "~/docker"
 
 
   # Enable provisioning with Puppet stand alone.  Puppet manifests
   # Enable provisioning with Puppet stand alone.  Puppet manifests
@@ -99,21 +102,29 @@ Vagrant.configure("1") do |config|
   #   chef.validation_client_name = "ORGNAME-validator"
   #   chef.validation_client_name = "ORGNAME-validator"
 end
 end
 
 
-Vagrant.configure("2") do |config|
+"#{Vagrant::VERSION}" < "1.1.0" and Vagrant::Config.run do |config|
+  v10(config)
+end
+
+"#{Vagrant::VERSION}" >= "1.1.0" and Vagrant.configure("1") do |config|
+  v10(config)
+end
+
+"#{Vagrant::VERSION}" >= "1.1.0" and Vagrant.configure("2") do |config|
   config.vm.provider :aws do |aws|
   config.vm.provider :aws do |aws|
-		config.vm.box = "dummy"
-		config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
+    config.vm.box = "dummy"
+    config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
     aws.access_key_id = ENV["AWS_ACCESS_KEY_ID"]
     aws.access_key_id = ENV["AWS_ACCESS_KEY_ID"]
-		aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
-		aws.keypair_name = ENV["AWS_KEYPAIR_NAME"]
-		aws.ssh_private_key_path = ENV["AWS_SSH_PRIVKEY"]
-		aws.region = "us-east-1"
+    aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
+    aws.keypair_name = ENV["AWS_KEYPAIR_NAME"]
+    aws.ssh_private_key_path = ENV["AWS_SSH_PRIVKEY"]
+    aws.region = "us-east-1"
     aws.ami = "ami-1c1e8075"
     aws.ami = "ami-1c1e8075"
     aws.ssh_username = "vagrant"
     aws.ssh_username = "vagrant"
-		aws.instance_type = "t1.micro"
+    aws.instance_type = "t1.micro"
   end
   end
   config.vm.provider :virtualbox do |vb|
   config.vm.provider :virtualbox do |vb|
-		config.vm.box = "quantal64_3.5.0-25"
-		config.vm.box_url = "http://get.docker.io/vbox/ubuntu/12.10/quantal64_3.5.0-25.box"
-	end
+    config.vm.box = "quantal64_3.5.0-25"
+    config.vm.box_url = "http://get.docker.io/vbox/ubuntu/12.10/quantal64_3.5.0-25.box"
+  end
 end
 end

+ 4 - 0
docs/README.md

@@ -0,0 +1,4 @@
+Docs readme
+===========
+
+Let's see if this file shows up as we hope it does.