sh 使用Docker Machine创建VM(https://github.com/docker/machine)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用Docker Machine创建VM(https://github.com/docker/machine)相关的知识,希望对你有一定的参考价值。

#!/bin/bash -eu

#source runabove-123-openrc.sh
source cloudovh-123-openrc.sh

docker-machine create \
  -d openstack \
  --openstack-flavor-name="ks-1" \
  --openstack-image-name="Ubuntu 14.04" \
  --openstack-net-name="Ext-Net" \
  --openstack-ssh-user="admin" \
  $1
#!/bin/bash -eu
#
# Create an GCE instance using gcloud (https://github.com/docker/machine).
#

[[ "$(which gcloud 2>/dev/null)" == "" ]] \
    && echo "Please download and install gcloud: curl https://sdk.cloud.google.com | bash" && exit 1

machineName=$1
projectName=$2

gcloud compute \
    --project "$projectName" instances create "$machineName" \
    --zone "europe-west1-a" \
    --machine-type "f1-micro" \
    --network "default" \
    --maintenance-policy "MIGRATE" \
    --scopes "https://www.googleapis.com/auth/devstorage.read_only" \
    --tags "http-server" "https-server" \
    --image "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140926"

gcloud compute config-ssh
#!/bin/bash -eu
#
# Create an AWS EC2 instance using docker-machine (https://github.com/docker/machine).
#

[ ! -f .ec2passwd ] \
    && echo 'AWS_KEY="?"' > .ec2passwd \
    && echo 'AWS_SECRET="?"' >> .ec2passwd \
    && echo 'AWS_VPC="?"' >> .ec2passwd \
    && echo "Please set AWS info in the file .ec2passwd" && exit 1

source .ec2passwd

machineName=$1

# Ubuntu Server 14.04.1 LTS (Trusty Tahr) 64 bits - EBS-SSD
# - http://cloud-images.ubuntu.com/releases/trusty/release-20150123/
# The AMI depends on the selected region:
# - eu-central-1 => ami 9c380b81
# - eu-west-1    => ami 234ecc54

docker-machine create \
    -d amazonec2 \
    --amazonec2-ami "ami-234ecc54" \
    --amazonec2-instance-type "$2" \
    --amazonec2-region "eu-west-1" \
    --amazonec2-access-key "$AWS_KEY" \
    --amazonec2-secret-key "$AWS_SECRET" \
    --amazonec2-vpc-id "$AWS_VPC" \
    $machineName

以上是关于sh 使用Docker Machine创建VM(https://github.com/docker/machine)的主要内容,如果未能解决你的问题,请参考以下文章

Failed to start machine “boot2docker-vm”: exit status 1

sh Docker-Machine安装

sh 连接到VPN后修复Docker Machine路由

sh ?为docker-machine中的所有机器调用Docker Remote API

sh ?为docker-machine中的所有机器调用Docker Remote API

sh 安装带有驱动程序的docker-machine