Kylie Norquist: Docker
module-name: "Docker"
area: "Core Technologies"
maintainers:
- davinwalker
- faleksic
Tackle stage 1 first and the last stage last, but the others can be completed in any order you prefer.
Stage 0: Create and commit to the module
-
Create an issue using this template by making the Issue Title: Docker - <your name>
-
Add yourself and your trainer as the assignees. -
Notify your manager to let them know you've started. -
Commit to this by notifying the current experts that they can start routing non-technical Docker questions to you. -
Optional: Set a milestone, if applicable, and a due date to help motivate yourself! -
Update support-team.yaml
to indicate that you've started learning this knowledge area:knowledge_areas: - name: docker level: 1
Stage 1: Theory
-
Done with Stage 1
Note: You can expense non-free learning materials to GitLab by following the How to Apply For Growth and Development Benefits handbook page.
-
Understand the difference between a VM and a Docker container by watching Containers vs VMs: What's the difference? video. -
Watch GitLab University Docker to understand containers a bit better. -
Read the docs for the GitLab Container Registry. -
Read the docs for the GitLab Docker Images. -
Watch Lesson 1 and Lesson 2 of Scalable Microservices With Kubernetes. -
(Optional) Consider getting the Docker and Kubernetes: The Complete Guide if you would like to learn more.
If you've taken the above course you don't need to watch it all as it's 20h+ long. If you did please proceed watch the following sections:
-
Dive Into Docker! -
Manipulating Containers with the Docker Client -
Building Custom Images Through Docker Server -
Making Real Projects with Docker
Remember, the "Docker and Kubernetes: The Complete Guide" contains useful stuff regarding Kubernetes, this is useful if you take the Kubernetes Part 1 module later.
Stage 2: Practical
-
Done with Stage 2
Now that we understand what Docker is its time to run some commands!
-
Install Docker on your machine, consider using alternatives mentioned in our Handbook | Docker Desktop page, podman is also a good alternative. -
To check if everything is operational run the hello-world container to print out a "hello world" message. -
Next we will print out some content from a docker container. Run the ubuntu:latest
image and print out the Ubuntu version withcat /etc/os-release
. -
After running the above command you might notice some containers that are no longer needed with docker ps -a
.-
Remove the ubuntu
container by runningdocker rm <CONTAINER_ID>
where theCONTAINER_ID
is the ID from the previous step. -
Confirm that you've deleted it with docker ps -a
, that container shouldn't be on the list.
-
-
Now we will go a bit deeper, we will jump into the container itself, think of it as ssh
-ing into the container. Read the documentation on Docker exec.-
Jump into a new ubuntu:latest
container and installcurl
(apt update && apt install curl
). -
Within the same container write something in a file named example.txt
(echo 'you dont have to write "something" you know' > example.txt
) -
Exit the container and then jump back in and read the contents of example.txt
(cat example.txt
). Note: You need to get the ID of the container you just left withdocker ps -a
in order to run it again withdocker run -it <CONTAINER_ID> /bin/bash
.
-
If you see the text you've written you've successfully wrote some persistent data - Good job! Remember, docker containers are made in a way so the contents is always the same no matter what machine is running them, by changing something within the container you can successfully override data.
Stage 3: A bit more hands on work
-
Done with Stage 3
Now that we've ran some containers and understood some basics behind them its time to create our own Docker container!
-
Follow the Simple application tutorial and create it. -
Continue with this by Updating the application. -
Learn about Docker Volumes. -
Learn about Exposing Ports
Stage 4: Tickets
-
Done with Stage 4
-
Find 10 Solved tickets to get a sense of what gets asked and how others have done troubleshooting in this area. -
__ -
__ -
__ -
__ -
__ -
__ -
__ -
__ -
__ -
__
-
-
Contribute valuable responses on at least 5 Docker-related tickets, even if a ticket seems too advanced for you to answer. Find the answers from an expert and relay them to the customers. -
__ -
__ -
__ -
__ -
__
-
Stage 5: Quiz
-
Done with Stage 5
Schedule a call with a Docker Expert (search for Docker
). During this call, you will guide them through the following:
-
Run a nginx:latest
docker container and expose the container port80
to8080
on your local machine (8080:80
). -
Open a browser and navigate to localhost:8080
and note the text "Welcome to nginx!" -
While the container is running, jump into the container and change the text "Welcome to nginx!" to "Welcome to Docker!". The file that needs to be edited is located at /usr/share/nginx/html/index.html
. -
Exit the container, stop it and remove it. -
Create and build the following Dockerfile with the tag of ubuntu-quiz:latest
:
FROM ubuntu:latest
RUN apt update && apt install vim --no-install-recommends -y
-
Run the image and print where vim
is installed (which vim
). -
Remove the image from the system (you need to remove the container first). -
Once you have completed this, have the expert comment below acknowledging your success.
Penultimate stage: Review
Any updates or improvements needed? If there are any dead links, out of date or inaccurate content, missing content whether in this module or in other documentation, list it below as tasks for yourself! Once ready, have a maintainer or manager review.
-
Update ...
Final Stage
Congratulations for finishing this module! Final steps:
-
Have your trainer review your tickets and assessment. If you do not have a trainer, ask an expert to review. -
Manager: schedule a call (or integrate into 1:1) to review how the module went. -
Consider taking the Container Registry module or Continuous Integration module. -
Update support-team.yaml
to indicate that you're ready to work on tickets in this knowledge area:knowledge_areas: - name: docker level: 2