3.11 Publish images
3.11.1 Push an image
If you didn’t do it yet, you can create an account in Docker Hub.
- Generate of an access key in Docker Hub
Let’s go back to our terminal and we use that access token. Username is your Docker Hub username.
- docker login
(base) [ec2-user@ip-172-31-47-200 ~]$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: myuser
Password:
WARNING! Your password will be stored unencrypted in /home/ec2-user/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
- Let’s create a repository in Docker Hub
We use one image we have in our system and we add a tag that matches our repository name.
docker pull biocontainers/fastqc:v0.11.9_cv7
Status: Downloaded newer image for biocontainers/fastqc:v0.11.9_cv7
docker.io/biocontainers/fastqc:v0.11.9_cv7
(base) [ec2-user@ip-172-31-45-86 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
biocontainers/fastqc v0.11.9_cv7 e5e3008d2bd1 6 months ago 834MB
(base) [ec2-user@ip-172-31-45-86 ~]$ docker tag biocontainers/fastqc:v0.11.9_cv7 toniher/fastqc-example:latest
(base) [ec2-user@ip-172-31-45-86 ~]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
biocontainers/fastqc v0.11.9_cv7 e5e3008d2bd1 6 months ago 834MB
toniher/fastqc-example latest e5e3008d2bd1 6 months ago 834MB
Then we push that new added tag and in shortly you will see in Docker Hub page.
3.11.2 Automatic builds
Create a Github repository
Add a Dockerfile (any of the ones used in the course). Keep in mind that if the recipe requires files (e.g., processed with COPY) you will need to upload them and place them in a way compatible with the context you choose.
Configure an automated build from Docker Hub
First you may need to grant permission to Github from your Docker Hub account. More information at: https://docs.docker.com/docker-hub/builds/link-source/