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 Dockerfile
$ 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
If you get the error: denied: requested access to the resource is denied
It might be due to the fact that you are not logged in, so check that before you start investigating all kinds of other things.
REF: StackOverflow: docker push error "denied: requested access to the resource is denied"
I found an interesting article on tagging.