[GH-ISSUE #1861] Connection refused for Postgres Service, but works on Github #905

Closed
opened 2026-03-01 21:47:19 +03:00 by kerem · 1 comment
Owner

Originally created by @epetre on GitHub (Jun 12, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1861

Bug report info

╰─ act --bug-report                               ─╯
act version:            0.2.46
GOOS:                   darwin
GOARCH:                 amd64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
        $HOME/.docker/run/docker.sock
Config files:
        /Users/emanuelpetre/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.20.4
        Module path:           command-line-arguments
        Main version:
        Main path:
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.46
                CGO_ENABLED:          1
                CGO_CFLAGS:
                CGO_CPPFLAGS:
                CGO_CXXFLAGS:
                CGO_LDFLAGS:
                GOARCH:               amd64
                GOOS:                 darwin
                GOAMD64:              v1
Docker Engine:
        Engine version:        24.0.2
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:
        OS arch:               x86_64
        OS kernel:             5.15.49-linuxkit-pr
        OS CPU:                4
        OS memory:             7959 MB
        Security options:
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

act -j test

Describe issue

This works as is on Github, but using act, it complains about not being able to connect to Postgres.

No response

Workflow content

runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:14
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: password
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

      redis:
        image: redis
        ports:
          - 6379:6379
        options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5


...

    - name: Database setup
      env:
        PGHOST: localhost
        PGUSER: postgres
        PGPASSWORD: password
      run: |
        bundle exec rails db:create
        bundle exec rails db:schema:load
        bundle exec rails db:test:prepare

Relevant log output

[Rspec/test] ⭐ Run Main Database setup
[Rspec/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir=
| Running via Spring preloader in process 1357
| connection to server at "::1", port 5432 failed: Connection refused
|       Is the server running on that host and accepting TCP/IP connections?
| connection to server at "127.0.0.1", port 5432 failed: Connection refused
|       Is the server running on that host and accepting TCP/IP connections?
...
| Caused by:
| PG::ConnectionBad: connection to server at "::1", port 5432 failed: Connection refused
|       Is the server running on that host and accepting TCP/IP connections?
| connection to server at "127.0.0.1", port 5432 failed: Connection refused

Additional information

No response

Originally created by @epetre on GitHub (Jun 12, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1861 ### Bug report info ```plain text ╰─ act --bug-report ─╯ act version: 0.2.46 GOOS: darwin GOARCH: amd64 NumCPU: 12 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock $HOME/.docker/run/docker.sock Config files: /Users/emanuelpetre/.actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.20.4 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.46 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: amd64 GOOS: darwin GOAMD64: v1 Docker Engine: Engine version: 24.0.2 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: x86_64 OS kernel: 5.15.49-linuxkit-pr OS CPU: 4 OS memory: 7959 MB Security options: name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act -j test ``` ### Describe issue This works as is on Github, but using act, it complains about not being able to connect to Postgres. ### Link to GitHub repository _No response_ ### Workflow content ```yml runs-on: ubuntu-latest services: postgres: image: postgres:14 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password ports: - 5432:5432 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 redis: image: redis ports: - 6379:6379 options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 ... - name: Database setup env: PGHOST: localhost PGUSER: postgres PGPASSWORD: password run: | bundle exec rails db:create bundle exec rails db:schema:load bundle exec rails db:test:prepare ``` ### Relevant log output ```sh [Rspec/test] ⭐ Run Main Database setup [Rspec/test] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir= | Running via Spring preloader in process 1357 | connection to server at "::1", port 5432 failed: Connection refused | Is the server running on that host and accepting TCP/IP connections? | connection to server at "127.0.0.1", port 5432 failed: Connection refused | Is the server running on that host and accepting TCP/IP connections? ... | Caused by: | PG::ConnectionBad: connection to server at "::1", port 5432 failed: Connection refused | Is the server running on that host and accepting TCP/IP connections? | connection to server at "127.0.0.1", port 5432 failed: Connection refused ``` ### Additional information _No response_
kerem 2026-03-01 21:47:19 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@ZauberNerd commented on GitHub (Jun 12, 2023):

This is a duplicate of: https://github.com/nektos/act/issues/173
Services are not yet implemented.

<!-- gh-comment-id:1587622666 --> @ZauberNerd commented on GitHub (Jun 12, 2023): This is a duplicate of: https://github.com/nektos/act/issues/173 Services are not yet implemented.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#905
No description provided.