I often have to save some of the docker containers to images, and then I need to transfer them or archive them. Recently I was working with the pebble SDK and a VM of mine was expiring, below is a reference on how to commit the container to image and then upload that image into docker hub.
Logging into Docker
docker login --username=yourusername
Creating a repo
this is done using the docker hub website, click create repo and give it a name etc.
Saving the container to an image
docker commit <container id> <image name>
Check image ID and Verify image is saved
Tagging your image
this is important step to ensure you attach your image to the repo your created and give it a tag. Tags denote sometimes the version name or the app name.
docker tag <image id> yourhubusername/yourreponame:tagname // example docker tag <ee38976d03cf> swiftmedia/mypebbledev:firsttrry
Pushing your image to the repo
docker push yourhubusername/yourreponame // example command docker push swiftmedia/mypebbledev