Day-16 of DevOps: Mastering Dockerfiles, Volumes, and Docker Compose π³
Source: Dev.to
ποΈ The Architecture
π My First Dockerfile
- Used
FROMto select a base image. - Used
COPYto move my code inside. - Used
CMDto tell the container what to do on startup.
πΎ Networks & Volumes (Persistence!)
Volumes
- Managed by Docker, great for database storage.
Networks
- Created custom bridge networks so my containers could talk to each other by name, rather than IP address.
π Docker Compose
docker-compose up -d
- The whole environment spun up instantly. No more manual linking!
βοΈ Docker Hub
- Created a repository on Docker Hub.
- Tagged my local image:
docker tag my-image my-username/my-repo:v1
- Pushed it to the cloud.
- Practiced pulling images from other users to understand how to leverage the communityβs work.
Takeaway
Docker Compose is a game-changer for local development environments!
What was the first image you ever built? Let me know in the comments! π