Skip to content

docker actions do not use the act runner container's dns or hosts file #439

Open
@AR2000AR

Description

Tools like docker/login-action and docker/build-push-action do not use the runner dns and hosts files.

Step to reproduce :

  • Create a workflow with custom container options for dns or hosts
  • use the docker/login-action or docker/build-push-action

Example workflow :

name: Build docker image
on:
  schedule:
    - cron: '@daily'
  push:

jobs:
  build:
    default:
      run:
        shell: bash
    runs-on: ubuntu-latest
    container: 
      image: catthehacker/ubuntu:act-latest
      options: "--dns 192.168.1.15 --add-host gitea.ar2000.me:192.168.1.15"
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Ping
        run: curl -o /dev/null  https://gitea.ar2000.me -v -s

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Login into image repo
        uses: docker/login-action@v3
        with:
          registry: gitea:3000
          username: ${{gitea.actor}}
          password: ${{secrets.DOCKER_TOKEN}}
          
      - name: Build and publish
        uses: docker/build-push-action@v6
        with:
          push: true
          pull: true
          tags: gitea:3000/ar2000/nextcloud:dev

The Ping step's purpose is to check that the dns setting is correctly applied. It return the following which is expected given the defined DNS server in this context (this server is used to return local IPs intead of public ones for the domain ar2000.me.

*   Trying 192.168.1.15:443...
* Connected to gitea.ar2000.me (192.168.1.15) port 443 (#0)
* 

Registry hostname are wrong on purpose to generate errors logs. The step Login into image repo using docker/login-action clearly show the wrong DNS server in it's error (8.8.8.8, should be 192.168.1.15)

Logging into gitea:3000...
::error::Error response from daemon: Get "https://gitea:3000/v2/": dial tcp: lookup gitea on 8.8.8.8:53: no such host

Test have been run on a self hosted gitea v1.22.2 instance with the runner container gitea/act_runner

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions