On my local machine, I've created an ec2 instance using docker-machine, using the following two commands:
$ docker-machine create \
--driver amazonec2 \
--amazonec2-open-port 8000 \
--amazonec2-iam-instance-profile iam-user \
default
$ eval "$(docker-machine env default)"
At this point, I'm stuck. I've navigated to a local directory where my Dockerfile
is and tried running docker build .
but that image gets built on my local machine. I've read the documentation, and there doesn't seem to exist anything like docker-machine build
.
Am I not understanding docker-machine conceptually? Should I copy over my project code to the ec2 instance and try it that way? If so, wouldn't something like that be against the point of using docker-machine in the first place?
As per David Maze's comment, I was mistaken, and the docker build
is actually run on the remote ec2 instance. Running $ eval "$(docker-machine env -u)"
points all docker commands to a remote/virtual instance.