Skip to content

Instantly share code, notes, and snippets.

@tcz001
Created December 19, 2016 23:22
Show Gist options
  • Save tcz001/eaadde9b311adcebd9529b220b687b17 to your computer and use it in GitHub Desktop.
Save tcz001/eaadde9b311adcebd9529b220b687b17 to your computer and use it in GitHub Desktop.
nvidia-docker-machine
#!/bin/bash
machine='awsdl'
AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
VPC='vpc-4dcc1228'
echo -n "Wait for a spot instance (y/n)? "
read answer
if echo "$answer" | grep -iq "^y" ;then
docker-machine create --driver amazonec2 \
--amazonec2-region us-west-2 \
--amazonec2-vpc-id ${VPC:-""} \
--amazonec2-ami ami-9210bbf2 \
--amazonec2-instance-type p2.xlarge \
--amazonec2-access-key ${AWS_ACCESS_KEY_ID} \
--amazonec2-secret-key ${AWS_SECRET_ACCESS_KEY} \
--amazonec2-request-spot-instance \
--amazonec2-spot-price 0.3 \
$machine
else
docker-machine create --driver amazonec2 \
--amazonec2-region us-west-2 \
--amazonec2-vpc-id ${VPC:-""} \
--amazonec2-ami ami-9210bbf2 \
--amazonec2-instance-type p2.xlarge \
--amazonec2-access-key ${AWS_ACCESS_KEY_ID} \
--amazonec2-secret-key ${AWS_SECRET_ACCESS_KEY} \
$machine
fi
export NV_HOST="ssh://ubuntu@$(docker-machine ip $machine):"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment