Use runner's DOCKER_HOST with default ubuntu container
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m6s

- Remove custom docker:latest container
- Use default ubuntu-latest (should inherit runner's DOCKER_HOST)
- Install docker.io client in job
- Check DOCKER_HOST environment variable
- Should use runner's tcp://docker-runner:2375 config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Kevin Sivic 2025-12-01 00:12:38 -05:00
parent 3f3540e97b
commit 41e3e11d05

View file

@ -8,38 +8,23 @@ on:
jobs:
build-and-push:
runs-on: ubuntu-latest
container:
image: docker:latest
steps:
- name: Debug network configuration
- name: Set up Docker (use runner's DOCKER_HOST)
run: |
echo "=== Network interfaces and routes ==="
ip route show 2>/dev/null || route -n
# The runner should have DOCKER_HOST set
echo "DOCKER_HOST from runner: ${DOCKER_HOST:-not set}"
echo ""
echo "=== Testing gateway IP directly ==="
GATEWAY_IP=$(ip route show | grep default | awk '{print $3}')
echo "Gateway IP: $GATEWAY_IP"
if timeout 2 sh -c "cat < /dev/null > /dev/tcp/$GATEWAY_IP/2375" 2>/dev/null; then
echo "✅ Can reach DIND at $GATEWAY_IP:2375"
echo "DOCKER_HOST=tcp://$GATEWAY_IP:2375" >> $GITHUB_ENV
export DOCKER_HOST=tcp://$GATEWAY_IP:2375
else
echo "❌ Cannot reach gateway at $GATEWAY_IP:2375"
echo "The DIND container might not be accessible from job containers"
echo "You may need to configure the runner to use --network=host or expose DIND port on host"
exit 1
# Install docker client if not present
if ! command -v docker &> /dev/null; then
echo "Installing docker client..."
apt-get update -qq && apt-get install -y -qq docker.io
fi
- name: Verify Docker connection
run: |
docker version
- name: Checkout repository
run: |
apk add --no-cache git
git clone ${{ github.server_url }}/${{ github.repository }} .
git checkout ${{ github.sha }}
ls -la