The Goal
Create and run my first Docker container. Simple goal: a Dockerfile that executes a Python “Hello World” script. No overthinking—just get containers working.
What I Built
A minimal Docker setup that:
- Builds an image from a Dockerfile
- Runs a Python script inside the container
- Outputs “Hello World” (and proves I understand the basics)
Tech Stack
- Docker — Container runtime
- Python — Simple script execution
Implementation
Dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY hello.py .
CMD ["python", "hello.py"]Python Script
# hello.py
print("Hello from Docker!")
print("Container is working.")Commands
# Build the image
docker build -t hello-docker .
# Run the container
docker run hello-dockerWhat I Learned
- Docker fundamentals: Images vs containers, build vs run
- Dockerfile syntax: FROM, WORKDIR, COPY, CMD
- Layer caching: Order matters in Dockerfiles
- Image tagging: How
-tnames your images
Challenges
Challenge: Docker Desktop eating RAM on my Mac. Solution: Adjusted resource limits in Docker Desktop settings. 4GB RAM is enough for basic containers.
Challenge: Forgetting to rebuild after changes.
Solution: docker build doesn’t auto-detect changes. Need to rebuild manually (or use docker-compose later).
Result
Container runs, prints output, exits cleanly. First Docker project: done. ✅
$ docker run hello-docker
Hello from Docker!
Container is working.
Simple, but it works. Foundation for everything else.
Related
- de-project-1-2-postgresql-in-docker
- 0-Data-Engineering-Fundamentals
- 10-Python-for-Data-Engineering
- fixing-immich-installation
Project: 1.1 of 28 | Month: January | Hours: ~3h GitHub: 1-1_Hello-Docker