Dockerhub
Where exactly are all of these images meant to go. So far we have been building images that already work on your local machine but to what end exactly. Docker is inherently about sharing code across different environments, so having a bunch of images on your local machine really isn't that helpful.
What we need some sort of registry to hold our images. In AWS parlance, this is called an Elastic Container Registry. In our example, we are going to push an image to docker hub, and then pull that same image back down.
Setting Up
First thing first, you will need to go to https://hub.docker.com/ and create a new repository to store your images. I created one called "images" (I am very creative).
Then head back down to your command line and do the following:
docker login
This will prompt you to enter your username and password. This will be the same one as your login for hub.docker.com.
Pushing (and Pulling) Your Image
This is a three part process. First you must tag (or retag) your image with the following structure: <username>/<repo_name>:<tag_name>
in order to be able to push it to docker hub.
Let's first look at all our images:
docker images
Then let's tag it:
docker tag 0bfa85891d47 corydonbaylor/images:flask
Finally, let's push it:
docker push corydonbaylor/images:flask
You should see a bunch of things happening in the command line and if they all succeed than you are a proud pusher to docker hub.
To then retrieve the image from docker hub, you would simply:
docker pull corydonbaylor/images:flask