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

旧巷老猫 提交于 2019-12-30 05:55:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!