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:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
# Self-contained: don't depend on the runner injecting a docker CLI or
|
# Fully self-contained: run dockerd inside the job container itself
|
||||||
# DOCKER_HOST into the default job image (observed not to be the case
|
# rather than relying on a separate dind service container (its
|
||||||
# in practice). actions/checkout needs Node, so use a node image and
|
# hostname failed to resolve via the embedded DNS resolver). Needs
|
||||||
# install the docker CLI, talking to our own dind sidecar. Plain
|
# the container itself to be privileged so dockerd can run at all.
|
||||||
# `docker` commands (not buildx) so DOCKER_HOST is honored directly.
|
container:
|
||||||
container: node:20-bookworm
|
image: node:20-bookworm
|
||||||
services:
|
|
||||||
docker:
|
|
||||||
image: docker:27-dind
|
|
||||||
options: --privileged
|
options: --privileged
|
||||||
env:
|
|
||||||
DOCKER_HOST: tcp://docker:2375
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Docker CLI
|
- name: Install and start Docker
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y --no-install-recommends ca-certificates curl
|
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" \
|
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
|
> /etc/apt/sources.list.d/docker.list
|
||||||
apt-get update
|
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
|
- name: Log in to Forgejo registry
|
||||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.rosenvold.tech -u "${{ github.actor }}" --password-stdin
|
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.rosenvold.tech -u "${{ github.actor }}" --password-stdin
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue