Overview
Teaching: 10 min Exercises: 5 minQuestions
Where can I store my containers?
Objectives
Learn how to upload your containers to Docker Hub
Using containers locally is great, but what if you lost your workstation and would like to quickly retrieve your container? Or what if you would like to share your container with collaborators?
You can upload your containers to a public repository called Docker Hub. It’s a free and unlimited service, but requires your to first register here. After registering you need to log in in your console:
docker login
Docker Hub takes container image names very seriously. Each image name has two components
username and image name: <username>/<image_name>
. For example filo/fsl_with_conda
.
To be able to upload an image to Docker Hub we need to rename it appropriately. In the folder without
our Dockerfile
we can add a new alias to our image:
docker build -t <username>/fsl_with_conda .
Now we are ready to upload the image:
docker push <username>/fsl_with_conda
After this process is finished we will be able to see the image listed on Docker Hub. For me this will be at https://hub.docker.com/u/filo/.
But does this work? Can I retrieve the image? Lets remove the local copy first
docker rmi fsl_with_conda <username>/fsl_with_conda
Exercises:
fsl_with_conda
?<username>/fsl_with_conda
?Key Points
You can store containers for your projects on Docker Hub and retrieve them at any time.