问题
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?
回答1:
Docker Hub will try to parse your Readme.md
iff you're doing an "Automated Build." For manual builds (where you push your own image), Docker Hub does not peek inside your image and has no way to know about your Readme. You'll need to manually add your Readme text to the Information section
回答2:
dockerhub-description GitHub Action can update the Docker Hub description from a README.md file.
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2.1.0
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_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
来源:https://stackoverflow.com/questions/29134275/how-to-push-a-docker-image-with-readme-file-to-docker-hub