Docker

Check if you are inside a Docker

Target> if [ -f "/.dockerenv" ] || grep -qE "^/docker/|/docker-ce/|/containerd/|/lxc/|/docker-[[:alnum:]]+/" /proc/1/cgroup ; then echo "Running inside a Docker container"; else echo "Not running inside a Docker container"; fi

Basic commands

# Check if docker service is running
sudo systemctl status docker

# If not running , start it
sudo systemctl stop docker
sudo systemctl start docker 

# List of images
docker images

# List of remote host images 
docker -H <target-ip>:2375 images

# List of running containers
docker ps -a

# Run the docker to an interactive container with a shell
docker exec -ti flast101 sh
-t: terminal
-i: interactive

# Connect to an running docker with an interactive shell 
docker exec -ti flast101 sh
-t: terminal
-i: interactive

# Run a docker 
docker run -di --name flast101 alpine:latest
-d: detach
-i: interactive

Test your knowledge

https://flast101.github.io/docker-privesc/arrow-up-right

PE Local Enumeration

Linpeas.sh may catch the docker group account. In this case, you may be able to run the quick PE win below.

Quick Privilege Escalation win

Last updated