If you are new to containers, words like Docker, entrypoint, and YAML can feel confusing.
This post explains them in simple English, using real-world examples.
1. What is Docker? (Think “boxed application”)
Docker is a way to package your application so it runs the same everywhere.
Imagine this:
- Your app needs Linux
- It needs certain tools (like MySQL client, curl, or Python)
- It needs specific versions of those tools
Instead of installing everything manually on every machine, Docker lets you put everything into one box.
That box is called a container image.
In simple terms:
Docker = a way to ship your app + everything it needs, together.
2. What is a Dockerfile?
A Dockerfile is a text file that tells Docker how to build the box.
Example:
FROM debian:12-slim
RUN apt-get install -y curl
COPY app.sh /app/app.sh
ENTRYPOINT ["/app/app.sh"]
This says:
- Start with Linux (
debian) - Install some tools
- Copy your script into the container
- Decide what runs when the container starts
3. What is entrypoint.sh?
The short answer:
entrypoint.sh is the first thing that runs when the container starts.
Think of it like:
- The main() function in a program
- Or the power button of the container
If Docker is the box, then entrypoint.sh is:
“What should this box do when it turns on?”
Example entrypoint.sh
#!/usr/bin/env bash
echo "Hello from the container"
When the container starts, this script runs automatically.
Why use entrypoint.sh?
It lets you:
- Run startup logic
- Check environment variables
- Start services
- Run jobs (like backups or migrations)
For example:
#!/usr/bin/env bash
echo "Starting backup..."
mysqldump mydb > backup.sql
Every time the container runs, it does exactly this job.
4. What is YAML and why is it used?
YAML is just a configuration file format.
It is used to describe:
- What container to run
- How much CPU/memory to use
- Environment variables
- When the container should run
YAML does not run code.
It only describes settings.
5. YAML vs entrypoint.sh (very important difference)
| File | Purpose |
|---|---|
entrypoint.sh | What the container does |
| YAML | How the container is configured |
Example YAML (simplified)
containers:
- image: myapp:1.0
env:
DB_HOST: localhost
This means:
- Run image
myapp:1.0 - Pass
DB_HOSTinto the container
Inside the container, entrypoint.sh can read that value.
6. How everything works together
Here’s the full flow:
- Dockerfile
- Builds the container image
- entrypoint.sh
- Runs when the container starts
- Does the actual work
- YAML
- Tells the platform how to run the container
- Sets memory, environment variables, schedule, etc.
In one sentence:
Docker builds the box, YAML configures it, and
entrypoint.shdoes the work.
7. Real-world analogy
Think of a coffee machine:
- Docker image → The coffee machine itself
- YAML → Settings (water amount, strength, timer)
- entrypoint.sh → The button that actually makes the coffee
You can change settings without rebuilding the machine, but the machine still needs a button to do something.
8. Why this separation is powerful
This design lets you:
- Change configuration without changing code
- Reuse the same image in dev, test, and prod
- Debug problems easily
- Run the same container locally and in the cloud
This is why containers are so popular in modern cloud systems.
Final takeaway
If you remember just one thing, remember this:
Docker builds the container, YAML configures it, and
entrypoint.shis what actually runs inside it.
Once this clicks, containers stop feeling complicated.

Add to favorites