Dockerhub 存储库说明

Dockerhub Repository Description

有人知道 dockerhub 如何管理自动构建存储库的描述吗?

Dockerhub 有一个很好的功能,即源存储库中的 README.md 被用作存储库描述。实际上,存储库的描述并不总是来自 master 分支的最新 README.md。它似乎非常随机或与最新版本相关。

示例存储库:

分支机构:

标签:

现在的问题是:如果我将所有标签都放在 Autobuild 上,那么它将无法重现,README.md 将显示在存储库描述中。

有没有什么技巧,或者有一个 API 可以让我设置描述的地方?

我的愿望是总是显示我的 master/README.md 的最新提交!

DockerHub doc提到:

The build process looks for a README.md in the same directory as your Dockerfile.

(参见 tombatossals/dockerhub/nodejs

If you have a README.md file in your repository, it is used in the repository as the full description.

If you change the full description after a build, is overwritten the next time the Automated Build runs.
To make changes, modify the README.md in your Git repository.

请注意,作为 by Andy,这不适用于手动构建。

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.


OP 询问:

Is there an API call where I can set the description of the repo?

我不知道 (Docker Hub API was deprecated in docker 1.8+)


Issue 467 报告相同的不确定性:

Sometimes the automated build system will still use the top-level README file.

issue 402报告:

"Every once in a while, the content in the Full Description and the Dockerfile page will be from an old release tag."

然后:

"Has the specification for pulling READMEs changed? It now takes the top-level README from the source repository instead of from the directory where the Dockerfile is specified; considering a common use-case is a repository of Dockerfiles this has completely messed up the documentation."

Issue 300 确认:

I notice two obvious failings here:

  • a) README.md 在 Dockerfile
  • 所在的 sub-directory 中不受尊重
  • b) 即使 README.md 在存储库的 top-level(以及 Dockerfile)中,“有时”它也不会被读入并且描述留空;即使在强制推送到底层存储库之后。

dockerhub-description GitHub 操作可以从 README.md 文件更新 Docker 集线器描述。

    - 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

您还可以独立于其他 CI 工具中的 GitHub 操作使用它。

    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

如果您正在寻找更新自述文件的工具,请查看 docker-pushrm。它是一个 Docker CLI 插件,向 Docker 添加了一个新命令:docker pushrm(用于:push readme)。在 Dockerhub 运行 上更新自述文件:

docker pushrm my-user/my-repo

它使用保存的 Docker 登录名,因此它在 docker login 后“正常工作”。它还支持其他容器注册(码头、港口)。

对于 CI 使用它也可以作为 Docker container and a github action

如果您正在寻找技术答案,请查看 the code of docker-pushrm. In short: You need to make a REST API request with your username/password to get a JWT token. And then make another REST API request with that JWT token to update repo info