π³Docker Linux Capabilities Labs
π― Objective
π§° Prerequisites
sudo apt update
sudo apt install libcap2-bin iputils-pingπΉ Lab 1: View Capabilities Inside a Docker Container
Step 1: Create and Start a custom container
FROM ubuntu:latest
RUN apt update && apt install -y iputils-ping libcap2-bin
CMD ["bash"]Step 2: Check capabilities
Excursive: π§ Capsh Section Breakdown

πΉ Lab 2: Drop All Capabilities
Step 1: Run a container with no capabilities
Step 2: Check no capabilities are set
Step 3: Try actions that need privileges
πΉ Lab 3: Add a Specific Capability
Step 1: Add back CAP_NET_RAW
CAP_NET_RAWStep 2: Check NET_RAW capability is set
Step 3: Try ping again
ping againπΉ Lab 4: Compare with Privileged Containers
Step 1: Run a privileged container
Step 2: Try mounting inside a container
Step 3: Check access to all (host) devices
πΉ Lab 5: Inspect Running Containers
Step 1: Run a container in the background
Step 2: Inspect the container
β
Wrap-Up
Last updated