Skip to content

Docker Containers

Master Docker Containers with 50 free flashcards. Study using spaced repetition and focus mode for effective learning in Programming.

🎓 50 cards ⏱️ ~25 min Advanced
Study Full Deck →
Share: 𝕏 Twitter LinkedIn WhatsApp

🎯 What You'll Learn

Preview Questions

12 shown

What is Docker?

Show ▼

Docker is an open-source platform that automates the deployment of applications inside lightweight, portable containers. Containers package an application with all its dependencies, ensuring it runs consistently across different environments.

What is a Docker container?

Show ▼

A Docker container is a runnable instance of a Docker image. It is an isolated process that shares the host OS kernel but has its own filesystem, networking, and process space. Containers are ephemeral by default.

What is a Docker image?

Show ▼

A Docker image is a read-only template used to create containers. It consists of layered filesystems built from a Dockerfile. Images are stored in registries and can be tagged with versions like myapp:1.0.

What does the FROM instruction do in a Dockerfile?

Show ▼

FROM sets the base image for subsequent instructions. It must be the first instruction in a Dockerfile (aside from ARG).
Example: FROM python:3.11-slim
You can also use FROM scratch to start with an empty image.

What does the RUN instruction do in a Dockerfile?

Show ▼

RUN executes a command during the image build process and commits the result as a new layer.
Example: RUN apt-get update && apt-get install -y curl
Best practice: chain commands with && to reduce layers.

What is the difference between COPY and ADD in a Dockerfile?

Show ▼

COPY simply copies files/directories from the build context into the image. ADD does the same but also supports:Automatic extraction of local .tar archivesFetching files from remote URLsBest practice: prefer COPY unless you need ADD's extra features.

What is the difference between CMD and ENTRYPOINT?

Show ▼

CMD provides default arguments that can be overridden at runtime. ENTRYPOINT sets the main executable that always runs.
When both are used, CMD supplies default arguments to ENTRYPOINT:
ENTRYPOINT ["python"]
CMD ["app.py"]

What does the EXPOSE instruction do?

Show ▼

EXPOSE documents which ports the container listens on at runtime. It does not actually publish the port.
Example: EXPOSE 8080
To publish ports, use docker run -p 8080:8080 at runtime.

What does the WORKDIR instruction do?

Show ▼

WORKDIR sets the working directory for subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions.
Example: WORKDIR /app
If the directory doesn't exist, it is created automatically.

What is the difference between ENV and ARG in a Dockerfile?

Show ▼

ENV sets environment variables that persist in the running container.
ARG defines build-time variables available only during the build.
Example:
ARG VERSION=1.0
ENV APP_ENV=production

What does the LABEL instruction do?

Show ▼

LABEL adds metadata to an image as key-value pairs.
Example: LABEL maintainer="dev@example.com" version="1.0"
Labels can be inspected with docker inspect and are useful for automation and documentation.

What does the VOLUME instruction do in a Dockerfile?

Show ▼

VOLUME creates a mount point and marks it as holding externally mounted volumes.
Example: VOLUME /data
Data in volumes persists beyond the container lifecycle and is managed by Docker on the host filesystem.

🎓 Start studying Docker Containers

🎮 Study Modes Available

🔄

Flashcards

Flip to reveal

🧠

Focus Mode

Spaced repetition

Multiple Choice

Test your knowledge

⌨️

Type Answer

Active recall

📚

Learn Mode

Multi-round mastery

🎯

Match Game

Memory challenge

Related Topics in Programming

📖 Learning Resources