Skip to content

ICMP pinger fails inside Docker: socket: permission denied even with NET_RAW + root #3

Description

@mkronvold

When running Lagident inside Docker, the ICMP pinger consistently fails with:
Error running pinger for : socket: permission denied

This occurs even when:

  • The container runs as root
  • NET_RAW and NET_ADMIN capabilities are added
  • /bin/ping works inside the container
  • Raw sockets work normally
  • Host networking is enabled
  • The target is 127.0.0.1 (loopback)

This suggests the issue is inside Lagident’s ICMP implementation rather than the container environment.


for testing purposes, I tried adding NET_RAW, NET_ADMIN and switching the network_mode to host

Docker Compose:

services:
  lagident:
    cap_add:
      - NET_RAW
      - NET_ADMIN
    network_mode: host
    environment:
      - DB_TYPE=sqlite
      - PROFILE=prod
    volumes:
      - ./lagident-sqlite-data:/data
    container_name: lagident
    image: nook24/lagident:latest
    restart: unless-stopped

Tests:

  • /bin/ping works (ICMP succeeds)
  • Verified Raw socket capability present: CapEff: 00000000a80435fb
  • Lagident runs as root
  • ICMP to 8.8.8.8 works
  • ICMP to 127.0.0.1 works via /bin/ping

Yet Lagident logs:

Error running pinger for 127.0.0.1: socket: permission denied

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions