Deploy container to other host througt docker-machine

Docker

Prepare

You can depoly container to AWS or DigitalOcean through docker-machine.

Create

1
2
3
4
5
6
docker-machine create \
--driver generic \
--generic-ssh-user=ec2-user \
--generic-ip-address=192.168.1.200 \
--generic-ssh-key ~/.ssh/id_rsa \
vm-192-168-1-200-sandbox

List

1
docker-machine ls

Switch / Active

1
2
3
4
5
6
7
8
# (optional) get the env of machine
docker-machine env vm-192-168-1-200-sandbox

# set active (do any docker command you want)
eval $(docker-machine env vm-192-168-1-200-sandbox)

# unset (back to localhost mode)
eval $(docker-machine env -u)

Deploy

1
2
3
cd /your/project/directory
docker build -t project-name .
docker run -p 80:80 project-name

Reference

https://docs.docker.com/machine/drivers/generic/#options