Developer Tools

The Only Docker Tutorial You Need to Get Started

Direct Answer

Docker packages an application with the runtime and system dependencies it needs, then runs that package as a container. The durable beginner workflow is: understand images and containers, write or generate a Dockerfile, build an image, run a container with an explicit port, inspect its logs, and use Compose when the application gains a database or another service.

The Coding Sloth's tutorial is unusually good at making that sequence memorable. Its recipe-and-meal analogy is simple without being misleading: the image is the recipe; the container is the meal produced from it. The commands are only useful after that distinction clicks.

Disclosure and date note: the primary video was published on 28 January 2025 and was sponsored by Docker. Creator-provided Docker links appear below as such. Commands and product screens can change, so current implementation notes are cross-checked against Docker's official documentation as of 17 September 2026.

Watch the Beginner Tutorial

Credit and disclosure: the walkthrough and Node example come from The Coding Sloth's Docker-sponsored video. The description links to Docker Desktop, Docker's product suite, and the creator's Sloth Bytes newsletter.

The Mental Model: Image, Container, Dockerfile

ConceptWhat it isWhat you do with it
DockerfileA text file containing build instructionsReview it, version it, and use it to build an image
ImageAn immutable application package assembled in layersTag, scan, store, and use it to create containers
ContainerA running, isolated process created from an imageStart, stop, inspect, replace, and connect it
VolumeStorage whose lifecycle is separate from a containerKeep database or user data when containers are replaced
Compose fileA declarative definition for several servicesStart the app, database, networks, and volumes together

A container is not a tiny virtual machine. Containers normally share the host's kernel while isolating processes, filesystems, networks, and other resources. That makes them lightweight, but it also means image provenance, privileges, mounts, secrets, and host configuration still matter.

Build the First Image Without Learning Bad Habits

The video containerizes a small Node server. The essential sequence remains sound: install Docker from the official installation page, verify the CLI with docker --version, create a Dockerfile, and build from the project directory.

A compact production-oriented starting point looks like this:

# syntax=docker/dockerfile:1
FROM node:22-bookworm-slim

WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev

COPY . .
ENV NODE_ENV=production
EXPOSE 3000
USER node
CMD ["npm", "start"]

Copying the package files before the application source lets Docker reuse the dependency layer when only source files change. The exec form of CMD gives the application cleaner signal handling. Running as the built-in non-root node user reduces privileges.

The matching .dockerignore should exclude at least:

node_modules
.git
.env*
npm-debug.log*

This keeps bulky local dependencies, repository history, and secrets out of the build context. A Dockerfile ENV instruction is appropriate for a non-secret default such as NODE_ENV; it is not a safe place for passwords or API keys. Supply secrets at runtime through an appropriate secret-management path.

A Deeper Lesson on Image Size and Build Layers

This requested follow-up goes further into layer order, multi-stage builds, and smaller final images. The durable rule is not “always use the smallest image.” Choose a trusted, supported base that contains what the runtime genuinely needs, then remove build tools and unnecessary packages from the final stage. Docker's current build guidance also recommends rebuilding regularly, pinning deliberately, and using a non-root user when the service permits it.

Build, Run, Debug, Then Scan

From the directory containing the Dockerfile:

docker build -t beginner-node-app .
docker run --rm --name beginner-node -p 3000:3000 beginner-node-app

The final period in docker build selects the current directory as the build context. The -t flag gives the image a readable tag. In the run command, the left side of 3000:3000 is the host port and the right side is the container port. The Node server must listen on 0.0.0.0 inside the container; listening only on localhost can make the published port appear broken.

Docker Desktop can show logs, resource use, image contents, and running containers. The terminal equivalents are useful when a GUI is unavailable:

docker ps
docker logs beginner-node
docker exec -it beginner-node sh
docker stop beginner-node

docker exec is an inspection tool, not the place to make durable fixes. If a change matters, put it in the Dockerfile or application source, rebuild the image, and replace the container.

The video closes this loop with Docker Scout. Scout can identify packages and known vulnerabilities and suggest remediation. It does not inspect every application flaw or prove that a container is safe. Review the source, image publisher, configuration, privileges, mounts, exposed ports, and secrets as separate layers.

Use Compose When the App Has More Than One Service

A backend and a database should usually remain separate services. A Compose file describes both, gives them a shared network, and attaches persistent storage to the database:

services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgres://app:${POSTGRES_PASSWORD}@db:5432/app
    depends_on:
      db:
        condition: service_healthy

  db:
    image: postgres:17
    environment:
      POSTGRES_DB: app
      POSTGRES_USER: app
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U app -d app"]
      interval: 5s
      timeout: 3s
      retries: 10

volumes:
  postgres_data:

Start it with docker compose up --build and stop it with docker compose down. The named volume survives that normal teardown. docker compose down -v removes it, so do not add -v casually when the volume contains data you need.

Keep the real password out of source control. Also note that startup order is not readiness: the health check above makes the app wait for a responsive database, not merely a database process that has started.

Three Deeper Lessons After the First Container

1. Learn the Map, Not Every Flag

This broader overview is useful once build, run, ports, and volumes feel concrete. Registries, orchestration, networking, and production deployment make more sense when each new concept answers a problem you have already encountered.

2. Use Containers to Keep Toolchains Contained

Containerizing a compiler, database, or CLI can keep version conflicts off the host, but “never install locally” is a provocative rule rather than a universal one. Native tools can be faster and integrate more naturally with the operating system. Use containers where repeatability, cleanup, or isolation pays for the added filesystem and networking complexity.

3. Let docker init Scaffold, Then Review

The joke at the end of the main tutorial contains a real shortcut: Docker Desktop's docker init can generate a Dockerfile, .dockerignore, compose.yaml, and README for supported application types. It is a starting point, not an approval stamp. Review generated ports, users, base images, copied files, commands, secrets, and volumes. The command warns before overwriting existing Docker files; preserve work you need before accepting that action.

A Useful First Hour With Docker

  1. Install Docker using the official instructions for your operating system and verify docker --version and docker compose version.
  2. Run one known sample image, inspect it in Docker Desktop, read its logs, stop it, and remove it.
  3. Containerize one tiny application. Make the app listen on 0.0.0.0, publish one port, and confirm it opens locally.
  4. Change only source code and rebuild. Notice which Dockerfile layers are cached and which rerun.
  5. Add .dockerignore, inspect the image, and confirm no .env, credentials, or local dependency directories were copied.
  6. Add one database with Compose and a named volume. Write a record, replace the containers, and prove that the record survives.
  7. Scan the image, fix one meaningful finding, rebuild, and record the image version you tested.
The finish line is not “Docker installed.” It is a small application that another person can start from the repository, with the same services, ports, and persistent data behavior you tested.

Video Chapters

TimeTopicTimeTopic
00:00Why “works on my machine” fails07:17Debugging containers and logs
00:49What Docker is07:43Scanning with Docker Scout
02:56Install and use Docker08:20Docker Compose and volumes
03:31Write a Dockerfile10:54Docker Build Cloud
06:24Build and tag the image11:42The docker init shortcut
06:51Run the container and map a port

Chapter times are derived from the supplied transcript and link directly to the relevant moment in the primary video.

Sources and Further Reading

Publication date follows the primary video's official YouTube date: 28 January 2025. Editorial review: 17 September 2026. Verify current installation requirements, product availability, image tags, and security guidance before implementation.

Common questions

What is the difference between a Docker image and a container?
An image is the packaged, read-only template containing an application and its runtime requirements. A container is a running instance created from that image. One image can create many separate containers.
Do I need Docker Desktop to use Docker?
Docker Desktop is the easiest supported starting point on Windows and macOS and includes the Docker CLI and Compose. Linux users can also install Docker Engine directly. Follow the current official instructions for your operating system.
Does EXPOSE make an application available on my computer?
No. EXPOSE documents the port used by the container. You still publish it when the container starts, for example with -p 3000:3000, and the application must listen on an address reachable from inside the container.
Will Docker Compose keep database data when containers are replaced?
Only when the database writes to a named volume or another persistent storage location. A normal docker compose down preserves named volumes, while docker compose down -v removes them. Back up important data separately.
Does Docker Scout prove an image is secure?
No. Scout can inventory packages and report known vulnerabilities, but it cannot guarantee that the image, configuration, source code, credentials, or runtime behavior is safe. Treat it as one review layer.
Share
X LinkedIn Reddit
Build Yours

Want a system
like this one?

Book a free 30-minute call. We map your situation, identify the highest-impact automation, and figure out if we are a fit.

Book Free 30-min Call