0
0
Jenkinsdevops~5 mins

Docker socket mounting in Jenkins - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Docker socket mounting in the context of Jenkins?
Docker socket mounting means connecting the Docker engine's communication socket from the host machine into the Jenkins container. This allows Jenkins to run Docker commands directly on the host's Docker engine.
Click to reveal answer
beginner
Why do we mount the Docker socket into a Jenkins container?
Mounting the Docker socket lets Jenkins control Docker on the host. This means Jenkins can build, run, and manage Docker containers without installing Docker inside the Jenkins container itself.
Click to reveal answer
beginner
What is the typical Docker socket file path mounted into Jenkins?
The Docker socket file path is usually /var/run/docker.sock on the host. It is mounted into the Jenkins container at the same path to allow communication.
Click to reveal answer
intermediate
Show the Docker run command snippet to start Jenkins with Docker socket mounted.
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 jenkins/jenkins
Click to reveal answer
intermediate
What is a security consideration when mounting the Docker socket into Jenkins?
Mounting the Docker socket gives Jenkins full control over the Docker engine and host system. If Jenkins or its plugins are compromised, attackers can control the host. So, it should be done carefully with trusted code.
Click to reveal answer
What does mounting /var/run/docker.sock into Jenkins allow?
AJenkins to run on a different port
BJenkins to run Docker commands on the host
CJenkins to store logs persistently
DJenkins to access the internet
Which Docker run option mounts the Docker socket into a container?
A--network host
B-p 8080:8080
C-v /var/run/docker.sock:/var/run/docker.sock
D-e DOCKER_HOST=/var/run/docker.sock
What risk comes with mounting the Docker socket into Jenkins?
AJenkins can control the host Docker engine, risking security
BJenkins can crash easily
CJenkins loses network access
DJenkins cannot build Docker images
If you want Jenkins to build Docker images, what is a simple way to enable this?
AMount the Docker socket into Jenkins container
BInstall Docker inside Jenkins container
CUse Jenkins without Docker
DRun Jenkins on a different port
What is the default path of the Docker socket on Linux hosts?
A/home/docker.sock
B/etc/docker.sock
C/usr/bin/docker.sock
D/var/run/docker.sock
Explain how mounting the Docker socket helps Jenkins run Docker commands.
Think about how Jenkins talks to Docker without installing Docker inside itself.
You got /4 concepts.
    Describe the security risks of mounting the Docker socket into Jenkins and how to mitigate them.
    Consider what happens if someone bad controls Jenkins with Docker socket access.
    You got /4 concepts.