Home › Docker Tutorial › All commands
All commands
Every command of this course: name, detailed description, syntax and example code.
Every command used in this course, with its name, a detailed description, the syntax and an example.
docker
Definition: The Docker daemon ( dockerd ) does the work and the docker command is the client that talks to it.
Syntax:
docker
Example:
docker run hello-world
FROM
Definition: FROM picks the base image, WORKDIR sets the working folder, COPY adds files, RUN runs a command while building, EXPOSE documents a port and CMD is what runs when the container starts.
Syntax:
FROM
Example:
FROM node:22-alpine
WORKDIR
Definition: FROM picks the base image, WORKDIR sets the working folder, COPY adds files, RUN runs a command while building, EXPOSE documents a port and CMD is what runs when the container starts.
Syntax:
WORKDIR
Example:
WORKDIR /app
COPY
Definition: FROM picks the base image, WORKDIR sets the working folder, COPY adds files, RUN runs a command while building, EXPOSE documents a port and CMD is what runs when the container starts.
Syntax:
COPY
Example:
COPY package.json ./ COPY . .
RUN
Definition: FROM picks the base image, WORKDIR sets the working folder, COPY adds files, RUN runs a command while building, EXPOSE documents a port and CMD is what runs when the container starts.
Syntax:
RUN
Example:
RUN npm install --omit=dev
EXPOSE
Definition: FROM picks the base image, WORKDIR sets the working folder, COPY adds files, RUN runs a command while building, EXPOSE documents a port and CMD is what runs when the container starts.
Syntax:
EXPOSE
Example:
EXPOSE 3000
CMD
Definition: FROM picks the base image, WORKDIR sets the working folder, COPY adds files, RUN runs a command while building, EXPOSE documents a port and CMD is what runs when the container starts.
Syntax:
CMD
Example:
CMD ["node", "server.js"]
depends_on
Definition: depends_on sets the start order, and compose creates a shared network so services reach each other by service name (for example host db ).
Syntax:
depends_on
Example:
depends_on:
db
Definition: depends_on sets the start order, and compose creates a shared network so services reach each other by service name (for example host db ).
Syntax:
db
Example:
- db db:
down
Definition: Useful commands: docker compose up -d (start in the background), docker compose ps (status), docker compose logs -f (follow logs), docker compose build (rebuild images) and docker compose down (stop and remove).
Syntax:
down
Example:
docker compose down
Example code
docker --version