โ† All Linux Flashcard Decks

Linux+ Container Operations with Docker Flashcards

7 cards from real Linux practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Linux+ Container Operations with Docker flashcards as text
  1. Which Docker command displays real-time resource usage statistics for all running containers?

    Answer: docker stats

    docker stats streams live CPU, memory, network I/O, and block I/O metrics for running containers.

  2. What does the Docker instruction ENTRYPOINT do differently than CMD in a Dockerfile?

    Answer: ENTRYPOINT defines the executable that cannot be overridden by docker run arguments; CMD provides defaults that can be overridden

    ENTRYPOINT sets the fixed executable for the container, while CMD arguments can be replaced by passing arguments to docker run.

  3. A developer needs to pass a build-time variable to a Dockerfile during docker build. Which instruction should be used?

    Answer: ARG

    ARG declares a variable that users can pass at build-time with --build-arg, unlike ENV which sets runtime environment variables.

  4. Which command removes all stopped containers, unused networks, dangling images, and build cache?

    Answer: docker system prune

    docker system prune is a bulk cleanup command that reclaims disk space by removing all unused Docker objects.

  5. When using docker cp, what is the correct syntax to copy a file from a running container to the host?

    Answer: docker cp container_name:container_path host_path

    docker cp uses container_name:path as the source and host path as destination when copying from a container to the host.

  6. Which Docker networking mode allows a container to share the host machine's network stack directly?

    Answer: host

    Host network mode removes network isolation between container and host, making the container use the host's IP and ports directly.

  7. What is the purpose of a Docker multi-stage build?

    Answer: To reduce final image size by copying only needed artifacts from earlier build stages

    Multi-stage builds use multiple FROM instructions so only compiled artifacts are copied into the final lightweight image, discarding build tools.