mirror of https://github.com/docker/docs.git
Merge branch 'master' into upgrade-govmomi-netip
This commit is contained in:
commit
73e8b0de2b
|
|
@ -113,7 +113,7 @@ func main() {
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
EnvVar: "MACHINE_STORAGE_PATH",
|
EnvVar: "MACHINE_STORAGE_PATH",
|
||||||
Name: "s, storage-path",
|
Name: "storage-path, s",
|
||||||
Value: mcndirs.GetBaseDir(),
|
Value: mcndirs.GetBaseDir(),
|
||||||
Usage: "Configures storage path",
|
Usage: "Configures storage path",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -21,16 +21,19 @@ with Docker Inc. Use 3rd party plugins at your own risk.
|
||||||
|
|
||||||
| Name | Repository | Maintainer GitHub Handle | Maintainer Email |
|
| Name | Repository | Maintainer GitHub Handle | Maintainer Email |
|
||||||
| ---------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
| ---------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
||||||
|
| 1&1 Cloud Server | <https://github.com/1and1/docker-machine-driver-oneandone> | [StackPointCloud, Inc.](https://github.com/stackpointcloud) | sdk@1and1.com |
|
||||||
| Aliyun ECS | <https://github.com/denverdino/docker-machine-driver-aliyunecs> | [denverdino](https://github.com/denverdino)<br/>[menglingwei](https://github.com/menglingwei) | denverdino@gmail.com<br/>v.con@qq.com |
|
| Aliyun ECS | <https://github.com/denverdino/docker-machine-driver-aliyunecs> | [denverdino](https://github.com/denverdino)<br/>[menglingwei](https://github.com/menglingwei) | denverdino@gmail.com<br/>v.con@qq.com |
|
||||||
| Amazon Cloud Formation | <https://github.com/jeffellin/machine-cloudformation> | [Jeff Ellin](https://github.com/jeffellin) | acf@ellin.com |
|
| Amazon Cloud Formation | <https://github.com/jeffellin/machine-cloudformation> | [Jeff Ellin](https://github.com/jeffellin) | acf@ellin.com |
|
||||||
| BrightBox | <https://github.com/brightbox/docker-machine-driver-brightbox> | [NeilW](https://github.com/NeilW) | neil@aldur.co.uk |
|
| BrightBox | <https://github.com/brightbox/docker-machine-driver-brightbox> | [NeilW](https://github.com/NeilW) | neil@aldur.co.uk |
|
||||||
| CenturyLink Cloud | <https://github.com/CenturyLinkCloud/docker-machine-driver-clc> | [ack](https://github.com/ack) | albert.choi@ctl.io |
|
| CenturyLink Cloud | <https://github.com/CenturyLinkCloud/docker-machine-driver-clc> | [ack](https://github.com/ack) | albert.choi@ctl.io |
|
||||||
|
| Citrix XenServer | <https://github.com/xenserver/docker-machine-driver-xenserver> | [robertbreker](https://github.com/robertbreker)<br>[phusl](https://github.com/phusl) | robert.breker@citrix.com<br>phus.lu@citrix.com |
|
||||||
| Docker-In-Docker | <https://github.com/nathanleclaire/docker-machine-driver-dind> | [nathanleclaire](https://github.com/nathanleclaire) | nathan.leclaire@gmail.com |
|
| Docker-In-Docker | <https://github.com/nathanleclaire/docker-machine-driver-dind> | [nathanleclaire](https://github.com/nathanleclaire) | nathan.leclaire@gmail.com |
|
||||||
| HPE OneView | <https://github.com/HewlettPackard/docker-machine-oneview> | [wenlock](https://github.com/wenlock)<br>[miqui](https://github.com/miqui) | wenlock@hpe.com<br>miqui@hpe.com |
|
| HPE OneView | <https://github.com/HewlettPackard/docker-machine-oneview> | [wenlock](https://github.com/wenlock)<br>[miqui](https://github.com/miqui) | wenlock@hpe.com<br>miqui@hpe.com |
|
||||||
| KVM | <https://github.com/dhiltgen/docker-machine-kvm> | [dhiltgen](https://github.com/dhiltgen) | daniel.hiltgen@docker.com |
|
| KVM | <https://github.com/dhiltgen/docker-machine-kvm> | [dhiltgen](https://github.com/dhiltgen) | daniel.hiltgen@docker.com |
|
||||||
| OpenNebula | <https://github.com/OpenNebula/docker-machine-opennebula> | [jmelis](https://github.com/jmelis) | jmelis@opennebula.org |
|
| OpenNebula | <https://github.com/OpenNebula/docker-machine-opennebula> | [jmelis](https://github.com/jmelis) | jmelis@opennebula.org |
|
||||||
| OVH Cloud | <https://github.com/yadutaf/docker-machine-driver-ovh> | [yadutaf](https://github.com/yadutaf) | jt@yadutaf.fr |
|
| OVH Cloud | <https://github.com/yadutaf/docker-machine-driver-ovh> | [yadutaf](https://github.com/yadutaf) | jt@yadutaf.fr |
|
||||||
| Packet | <https://github.com/packethost/docker-machine-driver-packet> | [betawaffle](https://github.com/betawaffle) | andy@packet.net |
|
| Packet | <https://github.com/packethost/docker-machine-driver-packet> | [betawaffle](https://github.com/betawaffle) | andy@packet.net |
|
||||||
|
| ProfitBricks | <https://github.com/profitbricks/docker-machine-driver-profitbricks> | [StackPointCloud, Inc.](https://github.com/stackpointcloud) | legal90@gmail.com |
|
||||||
| Parallels for OSX | <https://github.com/Parallels/docker-machine-parallels> | [legal90](https://github.com/legal90) | legal90@gmail.com |
|
| Parallels for OSX | <https://github.com/Parallels/docker-machine-parallels> | [legal90](https://github.com/legal90) | legal90@gmail.com |
|
||||||
| RackHD | <https://github.com/emccode/docker-machine-rackhd> | [kacole2](https://github.com/kacole2) | kendrick.coleman@emc.com |
|
| RackHD | <https://github.com/emccode/docker-machine-rackhd> | [kacole2](https://github.com/kacole2) | kendrick.coleman@emc.com |
|
||||||
| SAKURA CLOUD | <https://github.com/yamamoto-febc/docker-machine-sakuracloud> | [yamamoto-febc](https://github.com/yamamoto-febc) | yamamoto.febc@gmail.com |
|
| SAKURA CLOUD | <https://github.com/yamamoto-febc/docker-machine-sakuracloud> | [yamamoto-febc](https://github.com/yamamoto-febc) | yamamoto.febc@gmail.com |
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ func (c *GenericClient) CreateInstance(d *Driver) (string, error) {
|
||||||
Name: d.MachineName,
|
Name: d.MachineName,
|
||||||
FlavorRef: d.FlavorId,
|
FlavorRef: d.FlavorId,
|
||||||
ImageRef: d.ImageId,
|
ImageRef: d.ImageId,
|
||||||
|
UserData: d.UserData,
|
||||||
SecurityGroups: d.SecurityGroups,
|
SecurityGroups: d.SecurityGroups,
|
||||||
AvailabilityZone: d.AvailabilityZone,
|
AvailabilityZone: d.AvailabilityZone,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ type Driver struct {
|
||||||
KeyPairName string
|
KeyPairName string
|
||||||
NetworkName string
|
NetworkName string
|
||||||
NetworkId string
|
NetworkId string
|
||||||
|
UserData []byte
|
||||||
PrivateKeyFile string
|
PrivateKeyFile string
|
||||||
SecurityGroups []string
|
SecurityGroups []string
|
||||||
FloatingIpPool string
|
FloatingIpPool string
|
||||||
|
|
@ -161,6 +162,12 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
|
||||||
Usage: "Private keyfile to use for SSH (absolute path)",
|
Usage: "Private keyfile to use for SSH (absolute path)",
|
||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
|
mcnflag.StringFlag{
|
||||||
|
EnvVar: "OS_USER_DATA_FILE",
|
||||||
|
Name: "openstack-user-data-file",
|
||||||
|
Usage: "File containing an openstack userdata script",
|
||||||
|
Value: "",
|
||||||
|
},
|
||||||
mcnflag.StringFlag{
|
mcnflag.StringFlag{
|
||||||
EnvVar: "OS_NETWORK_NAME",
|
EnvVar: "OS_NETWORK_NAME",
|
||||||
Name: "openstack-net-name",
|
Name: "openstack-net-name",
|
||||||
|
|
@ -270,6 +277,16 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||||
d.SSHPort = flags.Int("openstack-ssh-port")
|
d.SSHPort = flags.Int("openstack-ssh-port")
|
||||||
d.KeyPairName = flags.String("openstack-keypair-name")
|
d.KeyPairName = flags.String("openstack-keypair-name")
|
||||||
d.PrivateKeyFile = flags.String("openstack-private-key-file")
|
d.PrivateKeyFile = flags.String("openstack-private-key-file")
|
||||||
|
|
||||||
|
if flags.String("openstack-user-data-file") != "" {
|
||||||
|
userData, err := ioutil.ReadFile(flags.String("openstack-user-data-file"))
|
||||||
|
if err == nil {
|
||||||
|
d.UserData = userData
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
d.SetSwarmConfigFromFlags(flags)
|
d.SetSwarmConfigFromFlags(flags)
|
||||||
|
|
||||||
return d.checkConfig()
|
return d.checkConfig()
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ func configureSwarm(p Provisioner, swarmOptions swarm.Options, authOptions auth.
|
||||||
},
|
},
|
||||||
Binds: []string{hostBind},
|
Binds: []string{hostBind},
|
||||||
PortBindings: map[string][]dockerclient.PortBinding{
|
PortBindings: map[string][]dockerclient.PortBinding{
|
||||||
"3376/tcp": {
|
fmt.Sprintf("%s/tcp", port): {
|
||||||
{
|
{
|
||||||
HostIp: "0.0.0.0",
|
HostIp: "0.0.0.0",
|
||||||
HostPort: port,
|
HostPort: port,
|
||||||
|
|
@ -99,8 +99,8 @@ func configureSwarm(p Provisioner, swarmOptions swarm.Options, authOptions auth.
|
||||||
Image: swarmOptions.Image,
|
Image: swarmOptions.Image,
|
||||||
Env: swarmOptions.Env,
|
Env: swarmOptions.Env,
|
||||||
ExposedPorts: map[string]struct{}{
|
ExposedPorts: map[string]struct{}{
|
||||||
"2375/tcp": {},
|
"2375/tcp": {},
|
||||||
"3376/tcp": {},
|
fmt.Sprintf("%s/tcp", port): {},
|
||||||
},
|
},
|
||||||
Cmd: cmdMaster,
|
Cmd: cmdMaster,
|
||||||
HostConfig: masterHostConfig,
|
HostConfig: masterHostConfig,
|
||||||
|
|
|
||||||
|
|
@ -332,9 +332,12 @@ func NewExternalClient(sshBinaryPath, user, host string, port int, auth *Auth) (
|
||||||
mode := fi.Mode()
|
mode := fi.Mode()
|
||||||
log.Debugf("Using SSH private key: %s (%s)", privateKeyPath, mode)
|
log.Debugf("Using SSH private key: %s (%s)", privateKeyPath, mode)
|
||||||
// Private key file should have strict permissions
|
// Private key file should have strict permissions
|
||||||
if mode != 0600 {
|
perm := mode.Perm()
|
||||||
// Abort with correct message
|
if perm&0400 == 0 {
|
||||||
return nil, fmt.Errorf("Permissions %#o for '%s' are too open.", mode, privateKeyPath)
|
return nil, fmt.Errorf("'%s' is not readable", privateKeyPath)
|
||||||
|
}
|
||||||
|
if perm&0077 != 0 {
|
||||||
|
return nil, fmt.Errorf("permissions %#o for '%s' are too open", perm, privateKeyPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args = append(args, "-i", privateKeyPath)
|
args = append(args, "-i", privateKeyPath)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package ssh
|
package ssh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
|
@ -46,39 +49,58 @@ func TestGetSSHCmdArgs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewExternalClient(t *testing.T) {
|
func TestNewExternalClient(t *testing.T) {
|
||||||
|
keyFile, err := ioutil.TempFile("", "docker-machine-tests-dummy-private-key")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer keyFile.Close()
|
||||||
|
|
||||||
|
keyFilename := keyFile.Name()
|
||||||
|
defer os.Remove(keyFilename)
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
sshBinaryPath string
|
sshBinaryPath string
|
||||||
user string
|
user string
|
||||||
host string
|
host string
|
||||||
port int
|
port int
|
||||||
auth *Auth
|
auth *Auth
|
||||||
|
perm os.FileMode
|
||||||
expectedError string
|
expectedError string
|
||||||
skipOS string
|
skipOS string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
sshBinaryPath: "/usr/local/bin/ssh",
|
|
||||||
user: "docker",
|
|
||||||
host: "localhost",
|
|
||||||
port: 22,
|
|
||||||
auth: &Auth{Keys: []string{"/tmp/private-key-not-exist"}},
|
auth: &Auth{Keys: []string{"/tmp/private-key-not-exist"}},
|
||||||
expectedError: "stat /tmp/private-key-not-exist: no such file or directory",
|
expectedError: "stat /tmp/private-key-not-exist: no such file or directory",
|
||||||
skipOS: "none",
|
skipOS: "none",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sshBinaryPath: "/usr/local/bin/ssh",
|
auth: &Auth{Keys: []string{keyFilename}},
|
||||||
user: "docker",
|
perm: 0400,
|
||||||
host: "localhost",
|
skipOS: "windows",
|
||||||
port: 22,
|
},
|
||||||
auth: &Auth{Keys: []string{"/dev/null"}},
|
{
|
||||||
expectedError: "Permissions 0410000666 for '/dev/null' are too open.",
|
auth: &Auth{Keys: []string{keyFilename}},
|
||||||
|
perm: 0100,
|
||||||
|
expectedError: fmt.Sprintf("'%s' is not readable", keyFilename),
|
||||||
|
skipOS: "windows",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
auth: &Auth{Keys: []string{keyFilename}},
|
||||||
|
perm: 0644,
|
||||||
|
expectedError: fmt.Sprintf("permissions 0644 for '%s' are too open", keyFilename),
|
||||||
skipOS: "windows",
|
skipOS: "windows",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
if runtime.GOOS != c.skipOS {
|
if runtime.GOOS != c.skipOS {
|
||||||
|
keyFile.Chmod(c.perm)
|
||||||
_, err := NewExternalClient(c.sshBinaryPath, c.user, c.host, c.port, c.auth)
|
_, err := NewExternalClient(c.sshBinaryPath, c.user, c.host, c.port, c.auth)
|
||||||
assert.EqualError(t, err, c.expectedError)
|
if c.expectedError != "" {
|
||||||
|
assert.EqualError(t, err, c.expectedError)
|
||||||
|
} else {
|
||||||
|
assert.Equal(t, err, nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue