Update .gitea/workflows/dockerbuild.yml
Some checks failed
Debug and Fix Docker Permissions / debug (push) Failing after 8s
Some checks failed
Debug and Fix Docker Permissions / debug (push) Failing after 8s
This commit is contained in:
@@ -1,23 +1,60 @@
|
||||
name: Build with DinD
|
||||
name: Debug and Fix Docker Permissions
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
jobs:
|
||||
build:
|
||||
debug:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker:dind
|
||||
options: --privileged
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Debug Initial State
|
||||
run: |
|
||||
echo "=== Initial Debug ==="
|
||||
whoami
|
||||
id
|
||||
groups
|
||||
ls -la /var/run/docker.sock
|
||||
sudo systemctl status docker
|
||||
|
||||
- name: Setup Docker
|
||||
run: |
|
||||
echo "=== Setting up Docker ==="
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker.io
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
|
||||
# Add user to docker group
|
||||
sudo usermod -aG docker ${{ github.actor }}
|
||||
|
||||
# Fix socket permissions
|
||||
if [ -S /var/run/docker.sock ]; then
|
||||
sudo chmod 666 /var/run/docker.sock
|
||||
fi
|
||||
|
||||
echo "=== After Setup ==="
|
||||
groups
|
||||
ls -la /var/run/docker.sock
|
||||
|
||||
- name: Test Docker Access
|
||||
run: |
|
||||
echo "=== Testing Docker Access ==="
|
||||
# This should work now
|
||||
docker --version
|
||||
docker info
|
||||
docker run --rm hello-world
|
||||
|
||||
- name: Build and Push
|
||||
# Test with sudo as fallback
|
||||
sudo docker info
|
||||
|
||||
# Test with hello-world
|
||||
sudo docker run --rm hello-world
|
||||
|
||||
- name: Final Verification
|
||||
run: |
|
||||
docker build -t my-image:${{ github.sha }} .
|
||||
# Your push commands here
|
||||
echo "=== Final Verification ==="
|
||||
echo "User: $USER"
|
||||
echo "Groups: $(groups)"
|
||||
echo "Docker version: $(docker --version)"
|
||||
echo "Docker info (should work):"
|
||||
docker info | head -5
|
||||
Reference in New Issue
Block a user