TryHackMe | Intro to Docker
Learn to create, build and deploy Docker containers!

Please note: It is strongly recommended that you are at least familiar with basic Linux syntax (such as running commands, moving files and familiarity with how the filesystem structure looks). If you have completed the Linux Fundamentals Module — you will be all set for this room!
Basic Docker commands
1.docker pull nginx: Pulls the Nginx image from Docker Hub.
2.docker image: Command used for operations related to Docker images.
3.docker image ls: Lists all Docker images currently on the system.
4.docker image rm: Deletes the specified Docker image from the system.
5.docker run -it helloworld /bin/bash: Runs the helloworld image and connects to an interactive bash shell.
6.docker ps: Lists running Docker containers.
7.docker ps -a: Lists all Docker containers, both running and stopped.
8.docker build -t helloworld . : Builds a Docker image named helloworld using the Dockerfile in the current directory.
Task 1: Introduction
No answer needed
Task 2: Basic Docker Syntax
1.If we wanted to pull a docker image, what would our command look like?
docker pull
- If we wanted to list all images on a device running Docker, what would our command look like?
docker image ls
- Let’s say we wanted to pull the image “tryhackme” (no quotations); what would our command look like?
docker pull tryhackme
- Let’s say we wanted to pull the image “tryhackme” with the tag “1337” (no quotations). What would our command look like?
docker pull tryhackme:1337
Task 3: Running Your First Container
1.What would our command look like if we wanted to run a container interactively? Note: Assume we are not specifying any image here.
docker run -it
- What would our command look like if we wanted to run a container in “detached” mode? Note: Assume we are not specifying any image here.
docker run -d
- Let’s say we want to run a container that will run and bind a webserver on port 80. What would our command look like? Note: Assume we are not specifying any image here.
docker run -p 80:80
- How would we list all running containers? Note: Assume we are not specifying any image here.
docker ps
- Now, how would we list all containers (including stopped)? Note: Assume we are not specifying any image here.
docker ps -a
Task 4: Intro to Dockerfiles
1.What instruction would we use to specify what base image the container should be using?
FROM
- What instruction would we use to tell the container to run a command?
RUN
- What docker command would we use to build an image using a Dockerfile?
build
- Let’s say we want to name this image; what argument would we use?
-t
Task 5: Intro to Docker Compose
- I want to use docker-compose to start up a series of containers. What argument allows me to do this?
up
- I want to use docker-compose to delete the series of containers. What argument allows me to do this?
down
- What is the name of the .yml file that docker-compose uses? Note: for this question, you will need to include the .yml file extension in your answer
docker-compose.yml
Task 6: Intro to the Docker Socket
What does the term “IPC” stand for?
Interprocess Communication
- What technology can the Docker Server be equalled to?
API
Task 7: Practical
- Connect to the machine. What is the name of the container that is currently running?

CloudIsland
- Use Docker to start a web server with the “webserver” image (no quotations). You will need to run the container with port 80.

After starting the container, try to connect to https://LAB_WEB_URL.p.thmlabs.com/ in your browser. What is the flag?

THM{WEBSERVER_CONTAINER}
Thank you for reading!