I'd like to deploy a container that I've built locally on a DigitalOcean droplet. I've been following these instructions. The problem is that by running:
eval $(docker-machine env DROPLET_NAME)
Docker sets the environment variables to be the remote machine, effectively changing the environment to running Docker on the remote machine. This is expected. However, say I have a local image I've built named rb612/docker-img:latest
that I haven't pushed up to a remote. I want to run this in the remote machine context.
If I run:
docker run -d -p 80:8000 rb612/docker-img:latest
Then I get Unable to find image 'rb612/docker-img:latest' locally
. If my understand is correct, this is because it's no longer running in the context of my machine. Opening a new shell and running the same command works fine without the remote environment variables set.
So I'm wondering if there's a way I can run this local image on my remote machine. I tried using the -w
flag to pass in the local path but I got the same error. Deploying instead with a remote docker image works fine.