Publish an image to DockerHub
Publishing a Docker image to DockerHub is very easy. Unfortunately there are a few variations, so when you are reading up on this process, you might get a bit confused.
So to add to that confusion, here is my take.
Build the Docker image you want to publish, based on your
$ docker build -t jonasbn/myimage .
Normally you would probably build, without your namespacing, but since out goal is to publish to DockerHub, the namespace is quite important.
Log in to DockerHub. This requires credentials. This step can often be skipped, not initially of course, but the
docker command is quite friendly when it comes to remembering you.
$ docker login
Push your newly built image to DockerHub
$ docker push jonasbn/myimage:latest
And if you use versioning, push the same image with a tag
$ docker push jonasbn/myimage:0.1.0