EX200 Manage containers Practice Question
A container running a database service needs to persist data across restarts. The administrator decides to use a named volume. Which command creates a named volume and mounts it correctly?
⚠ Common exam trap
Test-takers frequently confuse bind mounts with named volumes, assuming `-v` always creates a named volume when the source is not an absolute path, but Podman treats a non-absolute source as a host-relative path or volume name depending on context, and the exam tests the explicit use of `podman volume create` for named volumes.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
podman volume create dbdata && podman run -v dbdata:/var/lib/mysql mydb
It first creates a named volume with `podman volume create dbdata`, then mounts that named volume to the container's `/var/lib/mysql` directory using the `-v` flag. Named volumes are managed by Podman and persist data independently of the container lifecycle, ensuring data survives container restarts or removal.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
podman run -v /var/lib/mysql:/var/lib/mysql mydb
Why it's wrong here
This command uses -v with an absolute host path as the source, which tells Podman to create a bind mount directly to /var/lib/mysql on the host instead of a managed named volume. While the data may persist on the host, this approach bypasses Podman's volume management, often leading to permission mismatches (especially in rootless mode), unexpected host-directory creation, and no easy way to inspect or back up the mount with podman volume commands. It is therefore incorrect because a bind mount is not a named volume.
- ✓
podman volume create dbdata && podman run -v dbdata:/var/lib/mysql mydb
Why this is correct
This is the correct approach because podman volume create dbdata allocates a dedicated, managed volume in Podman's storage area, and the -v dbdata:/var/lib/mysql flag uses the non-absolute source to identify it as a named volume rather than a host path. Podman handles all lifecycle operations, permissions are configured correctly for the container's user, and the volume persists across container restarts and even after the container is removed. You can inspect it with podman volume inspect and reuse it with other containers, making it the right choice for durable database data.
- ✗
podman run --mount type=bind,src=dbdata,dst=/var/lib/mysql mydb
Why it's wrong here
The --mount flag with type=bind explicitly instructs Podman to treat src as a host filesystem path, not a named volume. Here, 'dbdata' is interpreted as a relative path, so Podman will look for (or create) a directory named 'dbdata' in the current working directory on the host, completely ignoring the dbdata volume created by podman volume create. This means the container will not use the managed volume, and database files will be written to an unintended location, potentially causing data loss or confusion. To use a named volume with --mount, you must specify type=volume instead.
- ✗
podman run --mount type=tmpfs,dst=/var/lib/mysql mydb
Why it's wrong here
This command mounts a tmpfs filesystem at /var/lib/mysql, which is backed by RAM or swap and is inherently ephemeral. Any data written to this mount is lost the moment the container stops, is restarted, or the host is rebooted, providing zero durability for a database. Additionally, tmpfs is constrained by memory limits and is not intended for persistent storage or sharing data across container restarts. Therefore, this option fails the core requirement of persisting database data.
Go deeper
Related to this question
About these practice questions
Courseiva writes every EX200 question from scratch — 427 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This EX200 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX200 exam.