Github runner 在构建 docker image 后磁盘空间不足

问题描述 投票:0回答:0

我有两个 github 存储库(称它们为 A 和 B),它们都有一个

.github/workflows/build_and_test.yml
文件,看起来几乎与此相同:

name: Build and test

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build-with-docker:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3
      - uses: docker/setup-buildx-action@v2
      - uses: docker/build-push-action@v3
        with:
          tags: my_tag:latest
          load: true
          context: .
          cache-from: type=gha
          cache-to: type=gha,mode=max

      - run: docker run my_tag pytest

回购 A

  • Dockerfile
    中的基本图像是
    r-base:4.2.1
    ,大约782MB
  • 我构建的图像最终约为 1.71GB
  • github 工作流从头到尾愉快地运行(图像构建,
    docker run my_tag pytest
    步骤运行,一切都很好)

回购 B

  • Dockerfile
    中的基本图像是
    pytorch/pytorch
    ,大约5.82GB
  • 我构建的图像最终约为 6.4GB
  • github 工作流有两个问题,一个是警告,一个是错误,我将在下面描述

警告是

You are running out of disk space. The runner will stop working when the machine runs out of disk space. Free space left: 0 MB

错误发生在

docker run my_tag pytest
步骤:我得到

Unable to find image 'my_tag:latest' locally
docker: Error response from daemon: pull access denied for my_tag, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

我怀疑这是一个转移注意力的问题,如果我解决了磁盘空间问题,它就会消失,尽管我不确定。

有没有办法在不更改其 Dockerfile 的情况下减少我在回购 B 中的

build-push-action
步骤使用的磁盘空间?我应该使用
https://github.com/docker/build-push-action#inputs
中描述的 no-cache-filters 输入吗?

(可能相关:How to remove old docker images in continuous integration to save disk space,尽管我正在寻找更适合我的 github 工作流程设置的答案。)

根据 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources github 的 Linux 运行器有 14 GB SSD 空间。

docker github-actions diskspace
© www.soinside.com 2019 - 2024. All rights reserved.