Run dockerd inside the job container, drop the dind service
Some checks failed
Build and push image / build-and-push (push) Failing after 1m24s
Some checks failed
Build and push image / build-and-push (push) Failing after 1m24s
The dind sidecar's hostname failed to resolve via the embedded DNS resolver (server misbehaving), so cross-container service networking isn't working reliably here. Run dockerd directly inside the (now privileged) job container instead, avoiding service networking entirely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
62a8480ef0
commit
fdb62dfa87
1 changed files with 15 additions and 14 deletions
|
|
@ -8,23 +8,18 @@ on:
|
|||
jobs:
|
||||
build-and-push:
|
||||
runs-on: docker
|
||||
# Self-contained: don't depend on the runner injecting a docker CLI or
|
||||
# DOCKER_HOST into the default job image (observed not to be the case
|
||||
# in practice). actions/checkout needs Node, so use a node image and
|
||||
# install the docker CLI, talking to our own dind sidecar. Plain
|
||||
# `docker` commands (not buildx) so DOCKER_HOST is honored directly.
|
||||
container: node:20-bookworm
|
||||
services:
|
||||
docker:
|
||||
image: docker:27-dind
|
||||
# Fully self-contained: run dockerd inside the job container itself
|
||||
# rather than relying on a separate dind service container (its
|
||||
# hostname failed to resolve via the embedded DNS resolver). Needs
|
||||
# the container itself to be privileged so dockerd can run at all.
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
options: --privileged
|
||||
env:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Docker CLI
|
||||
- name: Install and start Docker
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends ca-certificates curl
|
||||
|
|
@ -34,7 +29,13 @@ jobs:
|
|||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo $VERSION_CODENAME) stable" \
|
||||
> /etc/apt/sources.list.d/docker.list
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends docker-ce-cli
|
||||
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io
|
||||
dockerd &
|
||||
for i in $(seq 1 30); do
|
||||
docker info >/dev/null 2>&1 && break
|
||||
sleep 1
|
||||
done
|
||||
docker info >/dev/null 2>&1 || { echo "dockerd failed to start"; exit 1; }
|
||||
|
||||
- name: Log in to Forgejo registry
|
||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.rosenvold.tech -u "${{ github.actor }}" --password-stdin
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue