3.11 Publish images

3.11.1 Push an image

PUSH. Steve Snodgrass. CC-BY, Source: https://www.flickr.com/photos/stevensnodgrass/6117660537/

Figure 3.1: PUSH. Steve Snodgrass. CC-BY, Source: https://www.flickr.com/photos/stevensnodgrass/6117660537/

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.

docker push toniher/fastqc-example:latest
As already noted, default registry is Docker Hub. If using another one, it is necessary to prepend it as when pulling (e.g., docker push quay.io/toniher/myrepo)
Docker Hub PRO users have the option to have automatic builds generated when there is a change in an associated Git repository (Github). Alternatively, you can use Github Actions.