mirror of https://github.com/docker/docs.git
backend/gce: switch to container-vm image
This commit is contained in:
parent
c4b3c7e839
commit
ecfe57234f
|
@ -42,21 +42,12 @@ var (
|
||||||
"/zones/us-central1-a/machineTypes/n1-standard-1",
|
"/zones/us-central1-a/machineTypes/n1-standard-1",
|
||||||
"The reference to the instance type to create.")
|
"The reference to the instance type to create.")
|
||||||
gceImage = flag.String("image",
|
gceImage = flag.String("image",
|
||||||
"https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20131127",
|
"https://www.googleapis.com/compute/v1/projects/google-containers/global/images/container-vm-v20140522",
|
||||||
"The GCE image to boot from.")
|
"The GCE image to boot from.")
|
||||||
gceDiskName = flag.String("diskname", "docker-root", "Name of the instance root disk")
|
gceDiskName = flag.String("diskname", "docker-root", "Name of the instance root disk")
|
||||||
gceDiskSizeGb = flag.Int64("disksize", 100, "Size of the root disk in GB")
|
gceDiskSizeGb = flag.Int64("disksize", 100, "Size of the root disk in GB")
|
||||||
)
|
)
|
||||||
|
|
||||||
const startup = `#!/bin/bash
|
|
||||||
sysctl -w net.ipv4.ip_forward=1
|
|
||||||
wget -qO- https://get.docker.io/ | sh
|
|
||||||
until test -f /var/run/docker.pid; do sleep 1 && echo waiting; done
|
|
||||||
grep mtu /etc/default/docker || (echo 'DOCKER_OPTS="-H :8000 -mtu 1460"' >> /etc/default/docker)
|
|
||||||
service docker restart
|
|
||||||
until echo 'GET /' >/dev/tcp/localhost/8000; do sleep 1 && echo waiting; done
|
|
||||||
`
|
|
||||||
|
|
||||||
// A Google Compute Engine implementation of the Cloud interface
|
// A Google Compute Engine implementation of the Cloud interface
|
||||||
type GCECloud struct {
|
type GCECloud struct {
|
||||||
service *compute.Service
|
service *compute.Service
|
||||||
|
@ -258,14 +249,6 @@ func (cloud GCECloud) CreateInstance(name string, zone string) (string, error) {
|
||||||
Network: prefix + "/global/networks/default",
|
Network: prefix + "/global/networks/default",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Metadata: &compute.Metadata{
|
|
||||||
Items: []*compute.MetadataItems{
|
|
||||||
{
|
|
||||||
Key: "startup-script",
|
|
||||||
Value: startup,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
log.Printf("starting instance: %q", name)
|
log.Printf("starting instance: %q", name)
|
||||||
op, err := cloud.service.Instances.Insert(cloud.projectId, zone, instance).Do()
|
op, err := cloud.service.Instances.Insert(cloud.projectId, zone, instance).Do()
|
||||||
|
|
Loading…
Reference in New Issue