Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AR2000AR opened this issue Sep 8, 2024 · 0 comments
Open

Comments

@AR2000AR
Copy link

AR2000AR commented Sep 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant