sunsin1985
sunsin1985

Reputation: 2607

How to push a docker image with README file to docker hub?

I am trying to push a docker image to my private repo on docker hub. However, I do see that there is an "Information" section on the Docker Hub which I want to update with useful information about my image. I am wondering if I can push a README.md file and Docker Hub can parse this file and update the "Information" section with this. I am not sure if I should embed the README.md in my image for this to work?

Upvotes: 42

Views: 18437

Answers (3)

Andy
Andy

Reputation: 38237

Docker Hub will try to parse your Readme.md if you're doing an "Automated Build." For manual builds (where you push your own image), Docker Hub does not peek inside your image source code repository and has no way to know about your Readme. You'll need to manually add your Readme text to the Information section

Upvotes: 31

peterevans
peterevans

Reputation: 41950

dockerhub-description GitHub Action can update the Docker Hub description from a README.md file.

    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v3
      with:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}
        repository: peterevans/dockerhub-description

You can also use it independently of GitHub Actions in other CI tools.

    docker run -v $PWD:/workspace \
      -e DOCKERHUB_USERNAME='user1' \
      -e DOCKERHUB_PASSWORD='xxxxx' \
      -e DOCKERHUB_REPOSITORY='my-docker-image' \
      -e README_FILEPATH='/workspace/README.md' \
      peterevans/dockerhub-description:2.1.0

Upvotes: 24

Chris
Chris

Reputation: 685

docker-pushrm is a Docker CLI plugin that adds a new docker pushrm (speak: push readme) command to Docker. When it's installed you can push a README to Docker Hub, Quay or Harbor with:

$ ls
README.md
$ docker pushrm my-user/my-repo

It uses the the logins from Docker's credentials store, so it "just works" for registries that you're already logged into. I use it both interactively and for CI. There's also a github action based on it.

Upvotes: 22

Related Questions