目录 搜索
Compose About versions and upgrading (Compose) ASP.NET Core + SQL Server on Linux (Compose) CLI environment variables (Compose) Command-line completion (Compose) Compose(组成) Compose command-line reference(组合命令行参考) Control startup order (Compose) Django and PostgreSQL (Compose) Docker stacks and distributed application bundles (Compose) docker-compose build(docker-compose构建) docker-compose bundle docker-compose config docker-compose create docker-compose down docker-compose events docker-compose exec docker-compose help docker-compose images docker-compose kill docker-compose logs docker-compose pause docker-compose port docker-compose ps docker-compose pull docker-compose push docker-compose restart docker-compose rm docker-compose run docker-compose scale docker-compose start docker-compose stop docker-compose top docker-compose unpause docker-compose up Environment file (Compose) Environment variables in Compose Extend services in Compose Frequently asked questions (Compose) Getting started (Compose) Install Compose Link environment variables (deprecated) (Compose) Networking in Compose Overview of Docker Compose Overview of docker-compose CLI Quickstart: Compose and WordPress Rails and PostgreSQL (Compose) Sample apps with Compose Using Compose in production Using Compose with Swarm Engine .NET Core application (Engine) About images, containers, and storage drivers (Engine) Add nodes to the swarm (Engine) Apply custom metadata (Engine) Apply rolling updates (Engine) apt-cacher-ng Best practices for writing Dockerfiles (Engine) Binaries (Engine) Bind container ports to the host (Engine) Breaking changes (Engine) Build your own bridge (Engine) Configure container DNS (Engine) Configure container DNS in user-defined networks (Engine) CouchDB (Engine) Create a base image (Engine) Create a swarm (Engine) Customize the docker0 bridge (Engine) Debian (Engine) Default bridge network Delete the service (Engine) Deploy a service (Engine) Deploy services to a swarm (Engine) Deprecated Engine features Docker container networking (Engine) Docker overview (Engine) Docker run reference (Engine) Dockerfile reference (Engine) Dockerize an application Drain a node (Engine) Engine FAQ (Engine) Fedora (Engine) Get started (Engine) Get started with macvlan network driver (Engine) Get started with multi-host networking (Engine) How nodes work (Engine) How services work (Engine) Image management (Engine) Inspect the service (Engine) Install Docker (Engine) IPv6 with Docker (Engine) Join nodes to a swarm (Engine) Legacy container links (Engine) Lock your swarm (Engine) Manage nodes in a swarm (Engine) Manage sensitive data with Docker secrets (Engine) Manage swarm security with PKI (Engine) Manage swarm service networks (Engine) Migrate to Engine 1.10 Optional Linux post-installation steps (Engine) Overview (Engine) PostgreSQL (Engine) Raft consensus in swarm mode (Engine) Riak (Engine) Run Docker Engine in swarm mode Scale the service (Engine) SDKs (Engine) Select a storage driver (Engine) Set up for the tutorial (Engine) SSHd (Engine) Storage driver overview (Engine) Store service configuration data (Engine) Swarm administration guide (Engine) Swarm mode key concepts (Engine) Swarm mode overlay network security model (Engine) Swarm mode overview (Engine) Understand container communication (Engine) Use multi-stage builds (Engine) Use swarm mode routing mesh (Engine) Use the AUFS storage driver (Engine) Use the Btrfs storage driver (Engine) Use the Device mapper storage driver (Engine) Use the OverlayFS storage driver (Engine) Use the VFS storage driver (Engine) Use the ZFS storage driver (Engine) Engine: Admin Guide Amazon CloudWatch logs logging driver (Engine) Bind mounts (Engine) Collect Docker metrics with Prometheus (Engine) Configuring and running Docker (Engine) Configuring logging drivers (Engine) Control and configure Docker with systemd (Engine) ETW logging driver (Engine) Fluentd logging driver (Engine) Format command and log output (Engine) Google Cloud logging driver (Engine) Graylog Extended Format (GELF) logging driver (Engine) Journald logging driver (Engine) JSON File logging driver (Engine) Keep containers alive during daemon downtime (Engine) Limit a container's resources (Engine) Link via an ambassador container (Engine) Log tags for logging driver (Engine) Logentries logging driver (Engine) PowerShell DSC usage (Engine) Prune unused Docker objects (Engine) Run multiple services in a container (Engine) Runtime metrics (Engine) Splunk logging driver (Engine) Start containers automatically (Engine) Storage overview (Engine) Syslog logging driver (Engine) tmpfs mounts Troubleshoot volume problems (Engine) Use a logging driver plugin (Engine) Using Ansible (Engine) Using Chef (Engine) Using Puppet (Engine) View a container's logs (Engine) Volumes (Engine) Engine: CLI Daemon CLI reference (dockerd) (Engine) docker docker attach docker build docker checkpoint docker checkpoint create docker checkpoint ls docker checkpoint rm docker commit docker config docker config create docker config inspect docker config ls docker config rm docker container docker container attach docker container commit docker container cp docker container create docker container diff docker container exec docker container export docker container inspect docker container kill docker container logs docker container ls docker container pause docker container port docker container prune docker container rename docker container restart docker container rm docker container run docker container start docker container stats docker container stop docker container top docker container unpause docker container update docker container wait docker cp docker create docker deploy docker diff docker events docker exec docker export docker history docker image docker image build docker image history docker image import docker image inspect docker image load docker image ls docker image prune docker image pull docker image push docker image rm docker image save docker image tag docker images docker import docker info docker inspect docker kill docker load docker login docker logout docker logs docker network docker network connect docker network create docker network disconnect docker network inspect docker network ls docker network prune docker network rm docker node docker node demote docker node inspect docker node ls docker node promote docker node ps docker node rm docker node update docker pause docker plugin docker plugin create docker plugin disable docker plugin enable docker plugin inspect docker plugin install docker plugin ls docker plugin push docker plugin rm docker plugin set docker plugin upgrade docker port docker ps docker pull docker push docker rename docker restart docker rm docker rmi docker run docker save docker search docker secret docker secret create docker secret inspect docker secret ls docker secret rm docker service docker service create docker service inspect docker service logs docker service ls docker service ps docker service rm docker service scale docker service update docker stack docker stack deploy docker stack ls docker stack ps docker stack rm docker stack services docker start docker stats docker stop docker swarm docker swarm ca docker swarm init docker swarm join docker swarm join-token docker swarm leave docker swarm unlock docker swarm unlock-key docker swarm update docker system docker system df docker system events docker system info docker system prune docker tag docker top docker unpause docker update docker version docker volume docker volume create docker volume inspect docker volume ls docker volume prune docker volume rm docker wait Use the Docker command line (Engine) Engine: Extend Access authorization plugin (Engine) Docker log driver plugins Docker network driver plugins (Engine) Extending Engine with plugins Managed plugin system (Engine) Plugin configuration (Engine) Plugins API (Engine) Volume plugins (Engine) Engine: Security AppArmor security profiles for Docker (Engine) Automation with content trust (Engine) Content trust in Docker (Engine) Delegations for content trust (Engine) Deploying Notary (Engine) Docker security (Engine) Docker security non-events (Engine) Isolate containers with a user namespace (Engine) Manage keys for content trust (Engine) Play in a content trust sandbox (Engine) Protect the Docker daemon socket (Engine) Seccomp security profiles for Docker (Engine) Secure Engine Use trusted images Using certificates for repository client verification (Engine) Engine: Tutorials Engine tutorials Network containers (Engine) Get Started Part 1: Orientation Part 2: Containers Part 3: Services Part 4: Swarms Part 5: Stacks Part 6: Deploy your app Machine Amazon Web Services (Machine) Digital Ocean (Machine) docker-machine active docker-machine config docker-machine create docker-machine env docker-machine help docker-machine inspect docker-machine ip docker-machine kill docker-machine ls docker-machine provision docker-machine regenerate-certs docker-machine restart docker-machine rm docker-machine scp docker-machine ssh docker-machine start docker-machine status docker-machine stop docker-machine upgrade docker-machine url Driver options and operating system defaults (Machine) Drivers overview (Machine) Exoscale (Machine) Generic (Machine) Get started with a local VM (Machine) Google Compute Engine (Machine) IBM Softlayer (Machine) Install Machine Machine Machine CLI overview Machine command-line completion Machine concepts and help Machine overview Microsoft Azure (Machine) Microsoft Hyper-V (Machine) Migrate from Boot2Docker to Machine OpenStack (Machine) Oracle VirtualBox (Machine) Provision AWS EC2 instances (Machine) Provision Digital Ocean Droplets (Machine) Provision hosts in the cloud (Machine) Rackspace (Machine) VMware Fusion (Machine) VMware vCloud Air (Machine) VMware vSphere (Machine) Notary Client configuration (Notary) Common Server and signer configurations (Notary) Getting started with Notary Notary changelog Notary configuration files Running a Notary service Server configuration (Notary) Signer configuration (Notary) Understand the service architecture (Notary) Use the Notary client
文字

在AmazonWeb服务...

创建机器AmazonWeb服务,您必须提供两个参数:AWS访问密钥ID和AWS秘密访问密钥。

配置凭据

在使用amazonc 2驱动程序之前,请确保您已经配置了凭据。

AWS凭证文件

配置凭据的一种方法是为AmazonAWS使用标准凭据文件~/.aws/credentials文件,该文件可能如下所示:

[default]aws_access_key_id = AKID1234567890
aws_secret_access_key = MY-SECRET-KEY

在mac OS或各种类型的linux上,您可以安装AWS命令行接口%28aws cli%29在终端中使用aws configure命令,它指导您创建凭据文件。

这是最简单的方法,然后您可以使用以下方法创建一台新机器:

$ docker-machine create --driver amazonec2 aws01

命令行标志

或者,您可以使用这些标志。--amazonec2-access-key--amazonec2-secret-key在命令行上:

$ docker-machine create --driver amazonec2 --amazonec2-access-key AKI******* --amazonec2-secret-key 8T93C*******  aws01

环境变量

您可以使用环境变量:

$ export AWS_ACCESS_KEY_ID=AKID1234567890
$ export AWS_SECRET_ACCESS_KEY=MY-SECRET-KEY
$ docker-machine create --driver amazonec2 aws01

备选方案

  • --amazonec2-access-key::AmazonWebServicesAPI的访问密钥ID。

  • --amazonec2-ami要使用的实例的AMI ID。

  • --amazonec2-block-duration-minutes:AWS SPOT实例持续时间(分钟为%2860、120、180、240、300或360%29)。

  • --amazonec2-device-name实例的根设备名称。

  • --amazonec2-endpoint:可选端点URL%28主机名或完全限定URI%29

  • --amazonec2-iam-instance-profileAWS IAM角色名用作实例概要文件。

  • --amazonec2-insecure-transport:在发送请求时禁用SSL

  • --amazonec2-instance-type要运行的实例类型。

  • --amazonec2-keypair-name使用AWS键盘;需要-amazonec2-ssh-keypath

  • --amazonec2-monitoring*启用云监视监视。

  • --amazonec2-open-port::使指定的端口号可从因特网访问。

  • --amazonec2-private-address-only::仅使用专用IP地址。

  • --amazonec2-region启动实例时要使用的区域。

  • --amazonec2-request-spot-instance*使用SPOT实例。

  • --amazonec2-retries:为可恢复故障设置重试计数%28use-1以禁用%29

  • --amazonec2-root-size实例%28的根磁盘大小(GB%29)。

  • --amazonec2-secret-key::AmazonWebServicesAPI的秘密访问密钥。

  • --amazonec2-security-group:AWS VPC安全组名称。

  • --amazonec2-session-token::AmazonWebServicesAPI的会话令牌。

  • --amazonec2-spot-price:竞价型实例竞标价格(以美元计)。要求--amazonec2-request-spot-instance国旗。

  • --amazonec2-ssh-keypath例如,要使用的专用密钥文件的路径。将公钥与。酒吧扩展应该存在

  • --amazonec2-ssh-user:SSH登录用户名,它必须与所使用的ami中的默认SSH用户集相匹配。

  • --amazonec2-subnet-id:AWS VPC子网ID。

  • --amazonec2-tags:AWS额外标签键值对(逗号分隔,例如key1,value1,key2,value2)。

  • --amazonec2-use-ebs-optimized-instance::创建一个EBS优化实例,实例类型必须支持它。

  • --amazonec2-use-private-address使用专用IP地址的对接机,但仍然创建一个公共IP地址.

  • --amazonec2-userdata使用云init用户数据进行文件的路径。

  • --amazonec2-volume-type::要附加到实例的AmazonEBS卷类型。

  • --amazonec2-vpc-id:您的vpc ID启动实例。

  • --amazonec2-zone:在AWS区域中启动实例(即a,b,c,d,e中的一个)。

环境变量和默认值:

CLI选项

环境变量

默认

--amazonec2接入密钥

AWS_ACCESS_KEY_ID

-

--amazonec2秘密密钥

AWS_SECRET_ACCESS_KEY

-

--amazonec2会话令牌

AWS_SESSION_TOKEN

-

--amazonec2-朋友

AWS_AMI

ami-5f709f34

--amazonec2区域

AWS_DEFAULT_REGION

美国 - 东 -  1

--amazonec2-VPC-ID

AWS_VPC_ID

-

--amazonec2区

AWS_ZONE

一个

--amazonec2子网的ID

AWS_SUBNET_ID

-

--amazonec2安全组

AWS_SECURITY_GROUP

docker-machine

--amazonec2标签

AWS_TAGS

-

--amazonec2实例型

AWS_INSTANCE_TYPE

t2.micro

--amazonec2-设备名称

AWS_DEVICE_NAME

/ dev / sda1

--amazonec2根尺寸

AWS_ROOT_SIZE

16

--amazonec2容量式

AWS_VOLUME_TYPE

GP2

--amazonec2-IAM实例瞩目

AWS_INSTANCE_PROFILE

-

--amazonec2-SSH用户

AWS_SSH_USER

Ubuntu

--amazonec2请求现场实例

-

--amazonec2-现货价格

-

0.50

--amazonec2  - 使用 - 私人地址

-

--amazonec2-私人地址,只

-

--amazonec2监控

-

--amazonec2使用-EBS优化实例

-

--amazonec2-SSH-的keyPath

AWS_SSH_KEYPATH

-

--amazonec2重试次数

-

5

默认AMI

默认情况下,AmazonEC 2驱动程序将使用Ubuntu 16.04 lts的每日映像。

地区

AMI ID

ap-northeast-1

ami-b36d4edd

ap-southeast-1

ami-1069af73

ap-southeast-2

ami-1d336a7e

ca-central-1

ami-ca6ddfae

cn-north-1

ami-79eb2214

eu-west-1

ami-8aa67cf9

eu-central-1

ami-fe408091

sa-east-1

ami-185de774

us-east-1

ami-26d5af4c

us-west-1

ami-9cbcd2fc

us-west-2

ami-16b1a077

us-gov-west-1

ami-b0bad893

安全小组

注意,将创建一个安全组并将其与主机相关联。此安全组将打开以下入站端口:

  • ssh (22/tcp)

  • docker (2376/tcp)

  • swarm(3376 / tcp),只有当该节点是swarm主节点时

如果使用--amazonec2-security-group标志,将检查和打开上述端口,并修改安全组。如果您希望打开更多端口,比如特定于应用程序的端口,请使用AWS控制台并手动修改配置。

VPC ID

我们在命令开始时确定默认的VPC ID。在某些情况下,由于您的帐户没有默认的vpc,或者您不想使用默认的vpc,您可以使用--amazonec2-vpc-id旗子。

若要查找VPC ID,请执行以下操作:

  1. 登录到AWS控制台

  1. 转到服务 - > VPC  - >您的VPC

  1. VPC列中找到您想要的VPC ID 。

  1. 服务->vpc->子网.检查可用区列来验证该区域。a存在并匹配您的VPC ID。

例如,us-east1-aa可用性区域。如果a区域不存在,您可以在该区域中创建一个新的子网,或者在创建计算机时指定一个不同的区域。

若要创建具有非默认vpc-ID的计算机:

$ docker-machine create --driver amazonec2 --amazonec2-access-key AKI
******* --amazonec2-secret-key 8T93C
********* --amazonec2-vpc-id vpc-
****** aws02

此示例假定VPC ID位于a可用性区域。使用--amazonec2-zone属性以外的区域。a区域。例如,--amazonec2-zone c意指us-east1-c...

VPC连通性

机器使用SSH来完成EC2中实例的设置,并要求能够直接访问实例。

如果您使用该标志--amazonec2-private-address-only,则需要确保您有一些方法可以从VPC的内部网络中访问新实例(例如,公司VPN到VPC,VPC内的VPN实例或使用Docker-machine您的VPC中的一个实例)。

vpc的配置超出了本指南的范围,但是故障排除的第一步是确保如果您使用的是私有子网,那么您将遵循AWS VPC用户指南并有某种形式的NAT可用,使设置进程可以访问互联网完成设置。

自定义AMI和SSH用户名

默认AMI的默认SSH用户名是ubuntu

只有当您使用的自定义AMI具有不同的SSH用户名时,才需要更改SSH用户名。

您可以--amazonec2-ssh-user根据您选择的AMI 更改SSH用户名--amazonec2-ami

上一篇: 下一篇: