name: Debug and Fix Docker Permissions on: push: branches: [ main ] jobs: debug: runs-on: ubuntu-latest 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 # Test with sudo as fallback sudo docker info # Test with hello-world sudo docker run --rm hello-world - name: Final Verification run: | echo "=== Final Verification ===" echo "User: $USER" echo "Groups: $(groups)" echo "Docker version: $(docker --version)" echo "Docker info (should work):" docker info | head -5