Docker for Beginners: Run Any App Without Installing It

⏱ 1 min readUpdated 28 September 2026

Docker packages an app with everything it needs into a container. You can run PostgreSQL, Jupyter or a colleague’s script without installing anything on your PC and without breaking your other software.

In this article
  1. Image vs container
  2. First commands
  3. Jupyter notebooks in one command
  4. Your own script: a Dockerfile

Image vs container

  • Image — the recipe (read-only), e.g. postgres:11.
  • Container — a running copy of an image. Stop it, delete it, start a fresh one in seconds.

First commands

docker run --rm hello-world                     # test the install
docker run -d --name db -e POSTGRES_PASSWORD=secret -p 5432:5432 postgres:11
docker ps                                       # what is running
docker logs db                                  # its output
docker stop db && docker rm db                  # clean up

You now have a real PostgreSQL server for practising SQL, removable in one line.

Jupyter notebooks in one command

docker run -p 8888:8888 -v "%cd%":/home/jovyan/work jupyter/scipy-notebook

-v shares your current folder with the container, so notebooks are saved on your PC.

Your own script: a Dockerfile

FROM python:3.7-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY report.py .
CMD ["python", "report.py"]
docker build -t monthly-report .
docker run --rm monthly-report
💡 Anyone with Docker can now run your report the same way — no “which Python version do you have?” conversations.
✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong