In this lab assignment, you will learn to containerize applications using Docker, while focusing on best practices. Additionally, you will explore Docker multi-stage builds. Follow the tasks below to complete the lab assignment.
6 Points:
-
Create a
Dockerfile
:- Inside the
app_python
folder, craft aDockerfile
for your application. - Research and implement Docker best practices. Utilize a Dockerfile linter for quality assurance.
- Inside the
-
Build and Test Docker Image:
- Build a Docker image using your Dockerfile.
- Thoroughly test the image to ensure it functions correctly.
-
Push Image to Docker Hub:
- If you lack a public Docker Hub account, create one.
- Push your Docker image to your public Docker Hub account.
-
Run and Verify Docker Image:
- Retrieve the Docker image from your Docker Hub account.
- Execute the image and validate its functionality.
4 Points:
-
Enhance your docker image by implementing Docker Security Best Practices.
- No root user inside, or you will get no points at all.
-
Write
DOCKER.md
:- Inside the
app_python
folder, create aDOCKER.md
file. - Elaborate on the best practices you employed within your Dockerfile.
- Implementing and listing numerous Docker best practices will earn you more points.
- Inside the
-
Enhance the README.md:
- Update the
README.md
file in theapp_python
folder. - Include a dedicated
Docker
section, explaining your containerized application and providing clear instructions for execution.- How to build?
- How to pull?
- How to run?
- Update the
- Rootless container.
- Use COPY, but only specific files.
- Layer sanity.
- Use
.dockerignore
. - Use a precise version of your base image and language, example
python:3-alpine3.15
.
2.5 Points:
-
Dockerize Previous App:
- Craft a
Dockerfile
for the application from the prior lab. - Place this Dockerfile within the corresponding
app_*
folder.
- Craft a
-
Follow Main Task Guidelines:
- Apply the same steps and suggestions as in the primary Dockerization task.
-
Study Docker Multi-Stage Builds:
- Familiarize yourself with Docker multi-stage builds.
- Consider implementing multi-stage builds, only if they enhance your project's structure and efficiency.
- Utilize appropriate Markdown formatting and structure for all documentation.
- Organize files within the lab folder with suitable naming conventions.
- Create pull requests (PRs) as needed: from your fork to the main branch of this repository, and from your fork's branch to your fork's master branch.
Note: Utilize Docker to containerize your application, adhering to best practices. Explore Docker multi-stage builds for a deeper understanding, and document your process using Markdown.