

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Dockerfiles
incomplete
2: Building a Server
incomplete
3: Dockerizing the Server
incomplete
4: Creating an Environment
incomplete
5: Python Script
incomplete
6: Dockerizing Python Error
incomplete
7: Dockerizing Python
incomplete
This lesson's interactive features are locked, please to keep using them
Docker isn't only useful for running other people's software (as we've been doing so far). It's also a great way to build and package our own software.
I've used Docker both ways. As a DevOps/platform engineer I'm usually using other's images, but as a backend developer I was usually building images for our own servers.
Docker images are built from Dockerfiles. A Dockerfile is just a text file that contains all the commands needed to assemble an image. It's essentially the "Infrastructure as Code" (IaC) for an image. It runs commands from top to bottom, kind of like a shell script.
Instead of manually installing dependencies on servers and making updates manually, we can check a Dockerfile into source control and build it automatically. Mhmmmm, automation.
# This is a comment
# Use a lightweight debian os
# as the base image
FROM debian:stable-slim
# execute the 'echo "hello world"'
# command when the container runs
CMD ["echo", "hello world"]
docker build . -t helloworld:latest
The -t helloworld:latest flag tags the image with the name "helloworld" and the "latest" tag. Names are used to organize your images, and tags are used to keep track of different versions.
docker run helloworld
If all went well, you'll see "hello world" printed to the console!
Run and submit the CLI tests.