docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.97k forks source link

flag provided but not defined: -profile #4883

Closed brentgreeff closed 3 years ago

brentgreeff commented 3 years ago

I want to create a machine in an existing subnet:

docker-machine create \
  --profile staging \
  --driver amazonec2 \
  --amazonec2-instance-type "t2.micro" \
  --amazonec2-ami ami-0983862b6bc91d9f1 \
  --amazonec2-region "eu-central-1" \
  --amazonec2-zone "c" \
  --amazonec2-vpc-id vpc-101010110 \
  --amazonec2-subnet-id subnet-1010101 \
  --amazonec2-open-port 80 \
  --amazonec2-open-port 12201 \
  manager

Running aws ec2 describe-subnets --filters="Name=vpc-id,Values=vpc-1010101" --profile staging Shows my 3 subnets, but if I drop the --profile I see no subnets at all.

cat ~/.aws/config

[default]
region = eu-central-1

[profile staging]
role_arn = arn:aws:iam::1010101010101:role/FullAccessStaging
source_profile = default
region = eu-central-1

If I run docker-machine create and drop the --profile staging

Error setting machine configuration from flags provided: The desired subnet could not be located in this region. Is '--amazonec2-subnet-id' or AWS_SUBNET_ID configured correctly? Yes - this subnet is not in this region - in the main aws account - it only appears in the staging profile.

How can I specify the --profile - the way I do with all other aws cli commands?

brentgreeff commented 3 years ago

The solution is to create a new user with credentials for the other account.