8000 Proposal: Host management · Issue #8681 · moby/moby · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Proposal: Host management #8681
Closed
Closed
@bfirsh

Description

@bfirsh

Getting started with Docker is a pain. If you want to use Docker locally, you have to install boot2docker and figure out how to install and run it. If you want to use Docker remotely, you have to figure out how to spin up an instance on a cloud provider, install Docker, set up certificates to secure the connection, etc.

I am proposing we add a way of managing Docker hosts from within the client itself. It’ll let you create hosts on both cloud providers and local hypervisors, then set up the client to point at them.

It works a bit like this:

$ docker hosts
NAME         ACTIVE   DRIVER         STATE     URL
default      *                                 unix:///var/run/docker.sock

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

$ docker hosts
NAME      ACTIVE   DRIVER         STATE     URL
default                                     unix:///var/run/docker.sock
dev       *        virtualbox     Running   tcp://192.168.99.100:2375

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

$ docker hosts 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.

$ docker hosts
NAME      ACTIVE   DRIVER         STATE     URL
default                                     unix:///var/run/docker.sock
dev                virtualbox     Running   tcp://192.168.99.100:2375
staging   *        digitalocean   Running   tcp://104.131.184.151:2375

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

$ docker -H dev busybox echo hello I am dev
hello I am dev

$ docker hosts active dev
NAME      ACTIVE   DRIVER         STATE     URL
default                                     unix:///var/run/docker.sock
dev       *        virtualbox     Running   tcp://192.168.99.100:2375
staging            digitalocean   Running   tcp://104.131.184.151:2375

Initially, it will ship with a Virtualbox driver to replace the boot2docker client, and various drivers for cloud providers.

Active host

A host can be “active”, which means Docker commands will run against that host. This is a bit like selecting a branch in Git.

Client/daemon authentication and encryption

TLS will be enabled by default in the same release this ships.

Backwards compatibility

Docker ships with a hardcoded “default” host. The default host is always available, cannot be removed, and cannot be changed. When it is active, Docker behaves as it does at the moment (reads DOCKER_HOST, etc).

The -H option can be used to override the active host. If the host specified with -H is not prefixed with a protocol, Docker will attempt to look up a host of that name and use it. If there is a protocol, Docker will treat it as a URL to connect to.

Storage of host configuration

Hosts will be stored in flat files in your home directory so it is simple and accessible.

The configuration for a host is stored in ~/.docker/hosts/<name>/config.json, and a driver can store arbitrary files in ~/.docker/hosts/<name>/ (SSH keys, disk images, etc).

A file called ~/.docker/hosts/.active stores the name of the current active host.

Questions

Do we pick a single operating system? Is it the driver’s responsibility to choose the “best” operating system for a provider? Do we offer a choice of operating system?

How do we upgrade Docker on the hosts? Is this the driver’s responsibility? Is this the operating system’s responsibility? Could it be the Docker daemon’s responsibility?

Builds

As of 36583edf5c25fff1d33db411cdc2fbaafa2e5ea9

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0