machine

command module
v0.0.0-...-ee9e484 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2015 License: Apache-2.0 Imports: 25 Imported by: 0

README

Docker Machine

Machine makes it really easy to create Docker hosts on local hypervisors and cloud providers. It creates servers, installs Docker on them, then configures the Docker client to talk to them.

It works a bit like this:

$ machine create -d virtualbox dev
[info] Downloading boot2docker...
[info] Creating SSH key...
[info] Creating VirtualBox VM...
[info] Starting VirtualBox VM...
[info] Waiting for VM to start...
[info] "dev" has been created and is now the active host. Docker commands will now run against that host.

$ machine ls
NAME  	ACTIVE   DRIVER     	STATE 	URL
dev   	*    	virtualbox 	Running   tcp://192.168.99.100:2375

$ export DOCKER_HOST=`machine url` DOCKER_AUTH=identity

$ docker run busybox echo hello world
Unable to find image 'busybox' locally
Pulling repository busybox
e72ac664f4f0: Download complete
511136ea3c5a: Download complete
df7546f9f060: Download complete
e433a6c5b276: Download complete
hello world

$ machine create -d digitalocean --digitalocean-access-token=... staging
[info] Creating SSH key...
[info] Creating Digital Ocean droplet...
[info] Waiting for SSH...
[info] "staging" has been created and is now the active host. Docker commands will now run against that host.

$ machine ls
NAME      ACTIVE   DRIVER         STATE     URL
dev                virtualbox     Running   tcp://192.168.99.108:2376
staging   *        digitalocean   Running   tcp://104.236.37.134:2376

Machine creates Docker hosts that are secure by default. The connection between the client and daemon is encrypted and authenticated using new identity-based authentication. If you'd like to learn more about this, it is being worked on in a pull request on Docker.

## Try it out

Machine is still in its early stages. If you'd like to try out a preview build, download it here.

You will also need a version of Docker with identity authentication. Builds are available here:

Drivers

VirtualBox

Creates machines locally on VirtualBox. Requires VirtualBox to be installed.

Options:

  • --virtualbox-boot2docker-url: The URL of the boot2docker image. Defaults to the latest available version.
  • --virtualbox-disk-size: Size of disk for the host in MB. Default: 20000
  • --virtualbox-memory: Size of memory for the host in MB. Default: 1024

### Digital Ocean

Creates machines on Digital Ocean. You need to create a personal access token under "Apps & API" in the Digital Ocean Control Panel and pass that to machine create with the --digitalocean-access-token option.

Options:

  • --digitalocean-access-token: Your personal access token for the Digital Ocean API.
  • --digitalocean-image: The name of the Digital Ocean image to use. Default: docker
  • --digitalocean-region: The region to create the droplet in. Default: nyc3
  • --digitalocean-size: The size of the Digital Ocean driver. Default: 512mb
Microsoft Azure

Create machines on Microsoft Azure.

You need to create a subscription with a cert. Run these commands:

$ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
$ openssl pkcs12 -export -out mycert.pfx -in mycert.pem -name "My Certificate"
$ openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer

Go to the Azure portal, go to the "Settings" page, then "Manage Certificates" and upload mycert.cer.

Grab your subscription ID from the portal, then run machine create with these details:

$ machine create -d azure --azure-subscription-id="SUB_ID" --azure-subscription-cert="mycert.pem"

Options:

  • --azure-subscription-id: Your Azure subscription ID.
  • --azure-subscription-cert: Your Azure subscription cert.
Amazon EC2

Create machines on Amazon Web Services. You will need an Access Key ID, Secret Access Key and a VPC ID. To find the VPC ID, login to the AWS console and go to Services -> VPC -> Your VPCs. Select the one where you would like to launch the instance.

Options:

  • --amazonec2-access-key: Your access key id for the Amazon Web Services API.
  • --amazonec2-ami: The AMI ID of the instance to use Default: ami-a00461c8
  • --amazonec2-instance-type: The instance type to run. Default: t2.micro
  • --amazonec2-region: The region to use when launching the instance. Default: us-east-1
  • --amazonec2-root-size: The root disk size of the instance (in GB). Default: 16
  • --amazonec2-secret-key: Your secret access key for the Amazon Web Services API.
  • --amazonec2-vpc-id: Your VPC ID to launch the instance in.
  • --amazonec2-zone: The AWS zone launch the instance in (i.e. one of a,b,c,d,e).
Google Compute Engine

Create machines on Google Compute Engine. You will need a Google account and project name. See https://cloud.google.com/compute/docs/projects for details on projects.

The Google driver uses oAuth. When creating the machine, you will have your browser opened to authorize. Once authorized, paste the code given in the prompt to launch the instance.

Options:

  • --google-zone: The zone to launch the instance. Default: us-central1-a
  • --google-machine-type: The type of instance. Default: f1-micro
  • --google-username: The username to use for the instance. Default: docker-user
  • --google-instance-name: The name of the instance. Default: docker-machine
  • --google-project: The name of your project to use when launching the instance.

Contributing

GoDoc Build Status

Want to hack on Machine? Docker's contributions guidelines apply.

The requirements to build Machine are:

  1. A running instance of Docker
  2. The bash shell

To build, run:

$ script/build

From the Machine repository's root. Machine will run the build inside of a Docker container and the compiled binaries will appear in the project directory on the host.

By default, Machine will run a build which cross-compiles binaries for a variety of architectures and operating systems. If you know that you are only compiling for a particular architecture and/or operating system, you can speed up compilation by overriding the default argument that the build script passes to gox. This is very useful if you want to iterate quickly on a new feature, bug fix, etc.

For instance, if you only want to compile for use on OSX with the x86_64 arch, run:

$ script/build -osarch="darwin/amd64"

If you have any questions we're in #docker-machine on Freenode.

=======

Integration Tests

There is a suite of integration tests that will run for the drivers. In order to use these you must export the corresponding environment variables for each driver as these perform the actual actions (start, stop, restart, kill, etc).

By default, the suite will run tests against all drivers in master. You can override this by setting the environment variable MACHINE_TESTS. For example, MACHINE_TESTS="virtualbox" ./script/run-integration-tests will only run the virtualbox driver integration tests.

To run, use the helper script ./script/run-integration-tests.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/code.google.com/p/goauth2/oauth
Package oauth supports making OAuth2-authenticated HTTP requests.
Package oauth supports making OAuth2-authenticated HTTP requests.
_workspace/src/code.google.com/p/goauth2/oauth/example
This program makes a call to the specified API, authenticated with OAuth2.
This program makes a call to the specified API, authenticated with OAuth2.
_workspace/src/code.google.com/p/goauth2/oauth/jwt
The jwt package provides support for creating credentials for OAuth2 service account requests.
The jwt package provides support for creating credentials for OAuth2 service account requests.
_workspace/src/code.google.com/p/goauth2/oauth/jwt/example
This program makes a read only call to the Google Cloud Storage API, authenticated with OAuth2.
This program makes a read only call to the Google Cloud Storage API, authenticated with OAuth2.
_workspace/src/github.com/MSOpenTech/azure-sdk-for-go/core/http
Package http provides HTTP client and server implementations.
Package http provides HTTP client and server implementations.
_workspace/src/github.com/MSOpenTech/azure-sdk-for-go/core/http/cgi
Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
_workspace/src/github.com/MSOpenTech/azure-sdk-for-go/core/http/cookiejar
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
_workspace/src/github.com/MSOpenTech/azure-sdk-for-go/core/http/fcgi
Package fcgi implements the FastCGI protocol.
Package fcgi implements the FastCGI protocol.
_workspace/src/github.com/MSOpenTech/azure-sdk-for-go/core/http/httptest
Package httptest provides utilities for HTTP testing.
Package httptest provides utilities for HTTP testing.
_workspace/src/github.com/MSOpenTech/azure-sdk-for-go/core/http/httputil
Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
_workspace/src/github.com/MSOpenTech/azure-sdk-for-go/core/http/pprof
Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
_workspace/src/github.com/MSOpenTech/azure-sdk-for-go/core/tls
Package tls partially implements TLS 1.2, as specified in RFC 5246.
Package tls partially implements TLS 1.2, as specified in RFC 5246.
_workspace/src/github.com/codegangsta/cli
Package cli provides a minimal framework for creating and organizing command line Go applications.
Package cli provides a minimal framework for creating and organizing command line Go applications.
_workspace/src/github.com/digitalocean/godo
Package godo is the DigtalOcean API v2 client for Go
Package godo is the DigtalOcean API v2 client for Go
_workspace/src/github.com/docker/docker/pkg/pools
Package pools provides a collection of pools which provide various data types with buffers.
Package pools provides a collection of pools which provide various data types with buffers.
_workspace/src/github.com/docker/libtrust
Package libtrust provides an interface for managing authentication and authorization using public key cryptography.
Package libtrust provides an interface for managing authentication and authorization using public key cryptography.
_workspace/src/github.com/google/go-querystring/query
Package query implements encoding of structs into URL query parameters.
Package query implements encoding of structs into URL query parameters.
_workspace/src/github.com/smartystreets/go-aws-auth
Package awsauth implements AWS request signing using Signed Signature Version 2, Signed Signature Version 3, and Signed Signature Version 4.
Package awsauth implements AWS request signing using Signed Signature Version 2, Signed Signature Version 3, and Signed Signature Version 4.
_workspace/src/github.com/tent/http-link-go
Package link implements parsing and serialization of Link header values as defined in RFC 5988.
Package link implements parsing and serialization of Link header values as defined in RFC 5988.
_workspace/src/google.golang.org/api/compute/v1
Package compute provides access to the Compute Engine API.
Package compute provides access to the Compute Engine API.
_workspace/src/google.golang.org/api/googleapi
Package googleapi contains the common code shared by all Google API libraries.
Package googleapi contains the common code shared by all Google API libraries.
_workspace/src/google.golang.org/api/googleapi/internal/uritemplates
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
_workspace/src/google.golang.org/api/googleapi/transport
Package transport contains HTTP transports used to make authenticated API requests.
Package transport contains HTTP transports used to make authenticated API requests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL