⚡ ~/naveed Interview Prep
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Docker & Containers Interview Questions Scenario 149 of 158 in Docker & Containers
Staff Infrastructure Architect Docker Container Runtime & Systems Engineering Production Scenario

Q: A mission-critical C++ and Go payment gateway running inside Docker occasionally crashes with exit code 139 (`SIGSEGV` - Segmentation Fault). Because containers discard volatile state upon termination, no core dump file is produced, making postmortem debugging impossible. The development team is unable to locate the failing thread or memory address. You must configure the host kernel and container execution environment to capture full core dumps to a persistent host volume and analyze them using GDB.

Configure host Linux kernels and Docker containers to reliably generate core dumps during segmentation faults (`SIGSEGV`). Configure `/proc/sys/kernel/core_pattern`, ulimits, and debug with GDB.

#Docker #Linux #Debugging #Kernel #C++
🎙️ Candidate Opening & Architectural Context
"Configure host Linux kernels and Docker containers to reliably generate core dumps during segmentation faults (`SIGSEGV`). Configure `/proc/sys/kernel/core_pattern`, ulimits, and debug with GDB."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's Docker Certified Associate (DCA) Hands-On Lab Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Step 1

Understand Linux Kernel Core Pattern Mechanics for Containers

When a process crashes inside a container, the host kernel handles the core dump. If `/proc/sys/kernel/core_pattern` specifies a relative path (e.g., `core`), the file is written to the container's working directory and lost on container restart. To capture core dumps reliably, configure an absolute path on the host or pipe to a host handler.

# Configure host kernel core dump pattern to write to a dedicated host directory
echo '/var/coredumps/core.%e.%p.%h.%t' | sudo tee /proc/sys/kernel/core_pattern

# Ensure host directory exists and has permissive write permissions
sudo mkdir -p /var/coredumps && sudo chmod 1777 /var/coredumps
Pro Tip: Understand Linux Kernel Core Pattern Mechanics for Containers
Step 2

Enable Unlimited Core File Size in Docker Container

By default, Docker containers have a core dump ulimit of 0 (`ulimit -c 0`), which suppresses core dump generation. Pass `--ulimit core=-1:-1` at runtime to allow unlimited core dump sizes.

# Run container with unlimited core file size
docker run -d \
  --name payment-engine \
  --ulimit core=-1:-1 \
  -v /var/coredumps:/var/coredumps \
  payment-gateway:v3.2
Pro Tip: Enable Unlimited Core File Size in Docker Container
Advertisement
Step 3

Simulate Crash and Verify Core Dump Generation

Send `SIGSEGV` or `SIGABRT` to the running process inside the container. Verify that the Linux kernel generates a complete memory image in `/var/coredumps`.

# Send SIGSEGV to trigger segmentation fault
docker exec -it payment-engine kill -SIGSEGV 1

# Verify core dump file on host
ls -lh /var/coredumps/
# Output: -rw------- 1 1000 1000 482M Oct 06 12:00 core.payment-engine.1.container-host.1728216000
Pro Tip: Simulate Crash and Verify Core Dump Generation
Step 4

Inspect Stack Trace with GDB Inside Debug Container

Launch an ephemeral debugging container with GDB and debug symbols to inspect the backtrace and locate the exact crash line.

# Launch GDB to inspect thread backtrace
docker run --rm -v /var/coredumps:/dumps -v $(pwd)/symbols:/symbols ubuntu:22.04 \
  gdb /symbols/payment-engine /dumps/core.payment-engine... -ex "bt full" -ex "quit"
Pro Tip: Inspect Stack Trace with GDB Inside Debug Container
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Capturing core dumps from containers requires configuring the host's `/proc/sys/kernel/core_pattern` with an absolute path and launching containers with `--ulimit core=-1:-1`. Mounting the dump directory allows immediate analysis with GDB."
⚡ 60-Second Elevator Pitch Talking Points
  • W
  • e
  • s
  • o
  • l
  • v
  • e
  • d
  • i
  • n
  • t
  • e
  • r
  • m
  • i
  • t
  • t
  • e
  • n
  • t
  • s
  • e
  • g
  • m
  • e
  • n
  • t
  • a
  • t
  • i
  • o
  • n
  • f
  • a
  • u
  • l
  • t
  • c
  • r
  • a
  • s
  • h
  • e
  • s
  • i
  • n
  • o
  • u
  • r
  • n
  • a
  • t
  • i
  • v
  • e
  • p
  • a
  • y
  • m
  • e
  • n
  • t
  • r
  • u
  • n
  • t
  • i
  • m
  • e
  • s
  • b
  • y
  • c
  • o
  • n
  • f
  • i
  • g
  • u
  • r
  • i
  • n
  • g
  • k
  • e
  • r
  • n
  • e
  • l
  • c
  • o
  • r
  • e
  • d
  • u
  • m
  • p
  • c
  • a
  • p
  • t
  • u
  • r
  • e
  • .
  • B
  • y
  • s
  • e
  • t
  • t
  • i
  • n
  • g
  • t
  • h
  • e
  • h
  • o
  • s
  • t
  • `
  • c
  • o
  • r
  • e
  • _
  • p
  • a
  • t
  • t
  • e
  • r
  • n
  • `
  • t
  • o
  • a
  • n
  • a
  • b
  • s
  • o
  • l
  • u
  • t
  • e
  • p
  • a
  • t
  • h
  • a
  • n
  • d
  • p
  • a
  • s
  • s
  • i
  • n
  • g
  • `
  • -
  • -
  • u
  • l
  • i
  • m
  • i
  • t
  • c
  • o
  • r
  • e
  • =
  • -
  • 1
  • :
  • -
  • 1
  • `
  • t
  • o
  • c
  • o
  • n
  • t
  • a
  • i
  • n
  • e
  • r
  • s
  • ,
  • c
  • r
  • a
  • s
  • h
  • d
  • u
  • m
  • p
  • s
  • a
  • r
  • e
  • p
  • e
  • r
  • s
  • i
  • s
  • t
  • e
  • d
  • a
  • u
  • t
  • o
  • m
  • a
  • t
  • i
  • c
  • a
  • l
  • l
  • y
  • ,
  • e
  • n
  • a
  • b
  • l
  • i
  • n
  • g
  • d
  • e
  • v
  • e
  • l
  • o
  • p
  • e
  • r
  • s
  • t
  • o
  • p
  • i
  • n
  • p
  • o
  • i
  • n
  • t
  • f
  • a
  • u
  • l
  • t
  • y
  • m
  • e
  • m
  • o
  • r
  • y
  • p
  • o
  • i
  • n
  • t
  • e
  • r
  • s
  • w
  • i
  • t
  • h
  • G
  • D
  • B
  • i
  • n
  • m
  • i
  • n
  • u
  • t
  • e
  • s
  • .
Advertisement
Want more Docker & Containers scenarios?
Explore our complete collection of scenario-based Docker & Containers interview runbooks.
Browse All Docker & Containers Questions →