Curated

Services and User Management

0 votes

Questions133

  1. Question 51

    Services and User Management

    An administrator sets "dbsvc - nofile 65536" in /etc/security/limits.conf for the dbsvc account. The database service runs as dbsvc under systemd, but /proc/<PID>/limits still shows Max open files of 1024 and the service logs "too many open files". Which action BEST raises the limit for this service?

    Show the answer

    Correct answerD. Add LimitNOFILE=65536 to a systemd drop-in for the service, reload systemd, and restart the service

    Services started by systemd do not go through PAM, so limits.conf is not applied to them. LimitNOFILE= in the unit or a drop-in sets the limit at start. fs.file-max is a system-wide ceiling, not the per-process limit, so raising it leaves the service at 1024.

    Open this question
  2. Question 52

    Services and User Management

    A user runs nohup ./export.sh & from a terminal without redirecting its output, then logs out. What happens to the script?

    Show the answer

    Correct answerA. It keeps running, and its output is appended to a file named nohup.out

    AWhy this is right: nohup ignores SIGHUP and, when stdout is a terminal, appends output to nohup.out.

    BWhy not this: nohup keeps the output in nohup.out; it is discarded only if the user redirects it to /dev/null.

    CWhy not this: nohup sets the command to ignore SIGHUP, so logging out does not end it.

    DWhy not this: Mailing output to the user is what at and cron do; nohup writes it to nohup.out.

    nohup makes the command ignore SIGHUP and, when stdout is a terminal, sends output to nohup.out. It does not background the command by itself, which is why the trailing & is used to get the prompt back.

    Open this question
  3. Question 53

    Services and User Management

    An administrator edited the configuration file of a custom daemon named logshipd, which re-reads its configuration when it receives SIGHUP. The daemon must keep running without a restart, and its PID is not known. Which command applies the change?

    Show the answer

    Correct answerD. pkill -HUP logshipd

    pkill -HUP finds the process by name and sends signal 1, which triggers the daemon to reload its configuration. SIGTERM asks the process to exit, so the daemon would stop instead of reloading.

    Open this question
  4. Question 54

    Services and User Management

    The jobs command in a user's shell shows: [1]- Running ./sync.sh & and [2]+ Stopped ./report.sh. The user wants report.sh to continue running while still using the shell for other work. Which command does this?

    Show the answer

    Correct answerA. bg %2

    bg %2 resumes the stopped job number 2 in the background, so the prompt stays available. fg %2 would also resume it but in the foreground, which would tie up the terminal.

    Open this question
  5. Question 55

    Services and User Management

    An administrator starts a long-running tar archive in the foreground of a terminal and needs the shell prompt back immediately, but the archive must keep running. Which sequence of actions achieves this?

    Show the answer

    Correct answerA. Press Ctrl+z, then run bg

    Ctrl+z suspends the foreground job and returns the prompt, and bg resumes that stopped job in the background. Ctrl+c sends SIGINT and terminates the job, so there is nothing left for bg to resume.

    Open this question
  6. Question 56

    Services and User Management

    An administrator ran kill -15 4021 against an unresponsive process and waited, but the process is still running. The process holds no data that needs saving, and it must be ended now. Which command should the administrator run next?

    Show the answer

    Correct answerA. kill -KILL 4021

    SIGKILL (9) is handled by the kernel and cannot be caught or ignored, so it ends a process that is ignoring SIGTERM. Repeating SIGTERM (15) gives the same result, since the process already ignored it.

    Open this question
  7. Question 57

    Services and User Management

    An administrator must run /usr/local/bin/report.sh every Monday at 06:30 as the user reports, using that user's own schedule. Which action accomplishes this?

    Show the answer

    Correct answerA. Run crontab -u reports -e and add the line: 30 6 * * 1 /usr/local/bin/report.sh

    Per-user crontab entries use the order minute, hour, day of month, month, day of week, so 30 6 * * 1 means 06:30 every Monday. at runs a job only once, and the field-reversed entry would run at 30:00, which is invalid, so it is wrong.

    Open this question
  8. Question 58

    Services and User Management

    A laptop is usually powered off overnight. Which way of scheduling a daily maintenance job makes it still run after the next boot when its period has passed?

    Show the answer

    Correct answerA. A job entry in /etc/anacrontab

    AWhy this is right: anacron records when each job last ran and runs overdue jobs after boot.

    BWhy not this: cron runs jobs only at their set times and skips runs missed while the machine was off.

    CWhy not this: An at job runs once at a set time and does not repeat daily.

    DWhy not this: Without Persistent=true, a systemd timer does not run a job missed while the machine was off.

    anacron records the last run date of each job in timestamp files and runs overdue jobs after boot, which suits systems that are not always on. Cron does not catch up on missed runs when the machine was off at the scheduled time, and a systemd timer catches up only when Persistent=true is set.

    Open this question
  9. Question 59

    Services and User Management

    On an Ubuntu system with gcc and make already installed, running ./configure for a source tarball stops with the error "zlib.h: No such file or directory". Which action resolves the error?

    Show the answer

    Correct answerA. sudo apt install zlib1g-dev

    zlib.h is a header file shipped in the zlib1g-dev development package, which the build needs. zlib1g is tempting, but it holds only the runtime library, with no headers. build-essential supplies the compiler toolchain, which is already present.

    Open this question
  10. Question 60

    Services and User Management

    A RHEL 9 server must receive only fixes flagged in security advisories during this maintenance window. All other package updates must wait. Which command applies them?

    Show the answer

    Correct answerA. sudo dnf upgrade --security

    dnf upgrade --security installs only updates that are marked as security fixes. dnf check-update is tempting, but it only lists available updates and installs nothing. dnf distro-sync aligns all packages with repository versions, which is not limited to security fixes.

    Open this question
  11. Question 61

    Services and User Management

    On a Debian-based server, an administrator runs pip install requests and receives the error "externally-managed-environment". The script needs requests without altering packages managed by apt. What is the BEST approach?

    Show the answer

    Correct answerA. Create a virtual environment with python3 -m venv and run pip from inside it

    A virtual environment gives pip an isolated location, so the system Python and apt-managed packages stay untouched. Using sudo is tempting, but it does not lift the restriction and would risk overwriting distribution-managed files. Upgrading pip does not remove the marker restriction.

    Open this question
  12. Question 62

    Services and User Management

    An administrator removed nginx from an Ubuntu server with apt remove. The files in /etc/nginx are still present, and the administrator wants to reinstall nginx later with no leftover configuration. Which command deletes those remaining configuration files?

    Show the answer

    Correct answerA. sudo apt purge nginx

    apt purge removes a package's configuration files, including those left behind after a plain remove. apt autoremove is tempting, but it only removes dependencies that are no longer needed and does not delete a removed package's configuration. apt clean only empties the downloaded package cache.

    Open this question
  13. Question 63

    Services and User Management

    An administrator installs a local package file with rpm -i, and the package needs a library that is not installed. What happens?

    Show the answer

    Correct answerA. rpm stops with a failed dependencies error and installs nothing

    AWhy this is right: rpm checks dependencies against the installed package database and refuses the install if one is missing.

    BWhy not this: rpm does not use repositories; resolving and downloading dependencies is what dnf does.

    CWhy not this: rpm keeps no queue for dnf; it simply refuses the install.

    DWhy not this: A missing dependency stops the install unless --nodeps is used; it is not just a warning.

    rpm only checks the local file against the installed package database and fails with a dependency error if something is missing. dnf resolves and downloads dependencies from configured repositories, including for a local file given as dnf install ./file.rpm. The tempting belief that rpm -i fetches dependencies is wrong.

    Open this question
  14. Question 64

    Services and User Management

    A systems administrator on a RHEL-based server needs one package that is only available in the CRB repository, which is disabled by default. The change must apply to this single transaction, and the repository configuration files must stay unchanged. Which command meets this requirement?

    Show the answer

    Correct answerC. dnf install --enablerepo=crb package_name

    The --enablerepo option turns on a disabled repository only for the current dnf run and leaves the .repo files untouched. The config-manager --set-enabled command is tempting but writes enabled=1 to the configuration, making the change permanent.

    Open this question
  15. Question 65

    Services and User Management

    After a vendor repository is added to a Debian server, apt update fails with the error "The following signatures couldn't be verified because the public key is not available: NO_PUBKEY." Which action fixes this while keeping signature verification in place for that repository?

    Show the answer

    Correct answerC. Save the vendor's public key under /etc/apt/keyrings and reference it with signed-by

    Storing the vendor's public key in a keyring file and referencing it with signed-by lets apt verify the repository's signatures. Using trusted=yes is tempting but bypasses verification instead of fixing the missing key.

    Open this question
  16. Question 66

    Services and User Management

    A third-party repository is defined by a deb line in /etc/apt/sources.list.d/vendor.list on an Ubuntu server. The administrator wants apt to stop using this repository but keep the definition for later use. Which action accomplishes this?

    Show the answer

    Correct answerC. Comment out the deb line, then run apt update

    Commenting out the deb line stops apt from reading that source, and apt update refreshes the package index without it. Deleting the signing key is tempting, but it only causes signature errors for the repository, and the repository stays configured.

    Open this question
  17. Question 67

    Services and User Management

    An administrator downloads vendor-tool.rpm from a vendor's website. The vendor's public GPG key has already been imported into the RPM database. Which command verifies the package's digest and signature before it is installed?

    Show the answer

    Correct answerC. rpm -K vendor-tool.rpm

    rpm -K (--checksig) checks the digests and GPG signature of a package file against the imported keys. rpm -V is tempting, but it compares files of an already installed package against the RPM database and does not check a downloaded file's signature.

    Open this question
  18. Question 68

    Services and User Management

    An administrator on a Fedora-based system wants to see every configured repository, including those that are currently disabled, so the disabled ones can be reviewed. Which command displays this list?

    Show the answer

    Correct answerB. dnf repolist --all

    dnf repolist --all lists enabled and disabled repositories with their status. Plain dnf repolist is tempting, but by default it shows only enabled repositories, so the disabled ones would be missing.

    Open this question
  19. Question 69

    Services and User Management

    A Debian server runs a web application that is certified only against the installed nginx version. The administrator must keep running apt upgrade for other packages but stop nginx from being upgraded. Which command accomplishes this?

    Show the answer

    Correct answerA. apt-mark hold nginx

    apt-mark hold flags the package so apt will not upgrade, install or remove it until the hold is cleared. apt-mark manual only records that the package was installed explicitly, which protects it from autoremove but not from upgrades.

    Open this question
  20. Question 70

    Services and User Management

    A systems administrator manages a RHEL server where a vendor driver only works with the currently running kernel. The administrator needs every future dnf update to skip all kernel packages. Which line should be added to the [main] section of /etc/dnf/dnf.conf?

    Show the answer

    Correct answerA. exclude=kernel*

    The exclude directive in [main] removes the matching packages from all dnf transactions, so kernel updates are skipped. protected_packages only stops listed packages from being removed; it does not stop them being upgraded.

    Open this question
  21. Question 71

    Services and User Management

    An administrator wants to apply pending updates on a RHEL-based server, but the third-party repository with the ID epel must not be used for this one run. No configuration files may be modified. Which command meets this requirement?

    Show the answer

    Correct answerB. dnf update --disablerepo=epel

    The --disablerepo option ignores the named repository for that single command and leaves configuration files unchanged. --exclude takes package names, so it would only skip a package called epel; it would not skip the repository.

    Open this question
  22. Question 72

    Services and User Management

    A Debian administrator extracts a JDK to /opt/jdk-21 and wants the system to manage it as a candidate for the generic name java, using the link /usr/bin/java and a priority of 2100. Which command registers it?

    Show the answer

    Correct answerD. update-alternatives --install /usr/bin/java java /opt/jdk-21/bin/java 2100

    --install takes the link, the generic name, the real path and the priority, in that order. Swapping the link and name is the tempting mistake and makes the command fail. --set only selects an already registered alternative and takes no priority.

    Open this question
  23. Question 73

    Services and User Management

    On a system that uses update-alternatives, how is the generic command path /usr/bin/editor normally linked to the selected program?

    Show the answer

    Correct answerA. It is a symbolic link to /etc/alternatives/editor, which links to the chosen program

    AWhy this is right: The generic path links into /etc/alternatives, and that entry links to the selected program.

    BWhy not this: Alternatives uses symbolic links, not hard links, so the selection can point across filesystems.

    CWhy not this: The generic path stays fixed; only the link inside /etc/alternatives is changed.

    DWhy not this: No wrapper runs; the choice is resolved by the two symbolic links themselves.

    The alternatives system uses a two-level symlink chain: the generic path points into /etc/alternatives, and that entry points to the chosen binary. Changing the selection only updates the link in /etc/alternatives.

    Open this question
  24. Question 74

    Services and User Management

    An administrator ran update-alternatives --config editor and chose /usr/bin/vim.basic. Later a package was installed that registers a higher-priority editor alternative, but the system still uses vim.basic. Which command returns the editor link to automatic selection by highest priority?

    Show the answer

    Correct answerB. update-alternatives --auto editor

    A manual choice puts the group in manual mode, so new priorities are ignored until --auto restores automatic mode and selects the highest priority. --remove only deletes one registered path, and the group stays in manual mode if others remain.

    Open this question
  25. Question 75

    Services and User Management

    An administrator edited the Port directive in /etc/ssh/sshd_config on a remote server and must avoid a typo locking everyone out when the service restarts. Which command should be run BEFORE restarting the service to check the file for errors?

    Show the answer

    Correct answerA. sshd -t

    sshd -t runs in test mode, validating the configuration file and exiting without starting the daemon. systemctl daemon-reload is tempting, but it only rereads systemd unit files and never parses sshd_config.

    Open this question
  26. Question 76

    Services and User Management

    A package-provided unit file at /usr/lib/systemd/system/nginx.service needs an extra Environment= setting for the nginx service. The change must survive package updates. What is the best way to apply it?

    Show the answer

    Correct answerC. Run systemctl edit nginx to add a drop-in override, then restart the service

    systemctl edit creates a drop-in file under /etc/systemd/system/nginx.service.d/, which overrides the packaged unit and is not replaced by updates. Editing the file in /usr/lib is tempting, but a package update can overwrite it.

    Open this question
  27. Question 77

    Services and User Management

    A user installed a Flatpak application on a workstation. The application cannot see files in /mnt/data, although the user can read them in a terminal. The administrator wants to fix this without weakening the other sandbox restrictions. Which action BEST meets the requirement?

    Show the answer

    Correct answerA. Run flatpak override --filesystem=/mnt/data for the application ID

    A Flatpak sandbox exposes only the host paths its permissions allow, and flatpak override grants access to one extra path for that app. Changing file mode bits does not help, because the sandbox limits visibility regardless of Unix permissions, and it weakens security.

    Open this question
  28. Question 78

    Services and User Management

    An administrator tries to edit a configuration file under /snap/app/current/ and receives a "Read-only file system" error. The root filesystem is mounted read-write. What BEST explains the error?

    Show the answer

    Correct answerB. The snap's contents are mounted from a compressed, read-only squashfs image

    A snap is delivered as a squashfs image that is mounted read-only, so files inside it cannot be edited; mutable data belongs in the snap's per-user or common data directories. SELinux would return a permission denied error, not a read-only filesystem error.

    Open this question
  29. Question 79

    Services and User Management

    An administrator adds an A record to the example.com zone file on the primary BIND server and runs rndc reload. The primary returns the new record, but a secondary server still answers with the old data. What is the most likely cause?

    Show the answer

    Correct answerA. The SOA serial number was not incremented before the reload

    Secondaries compare the SOA serial number with their own copy and only transfer the zone when the primary's serial is higher. Without an increment, the secondary sees no change. A full restart is unnecessary because rndc reload already loads the edited zone on the primary.

    Open this question
  30. Question 80

    Services and User Management

    After editing /etc/nginx/nginx.conf, an administrator wants to check the configuration for syntax errors without affecting the running service. Which command should be used?

    Show the answer

    Correct answerB. nginx -t

    AWhy not this: nginx -s reload signals the running master to load the new configuration, which affects the service.

    BWhy this is right: Nginx -t parses the configuration and reports errors without touching the running service.

    CWhy not this: A restart stops and starts the service, and a bad configuration would leave it down.

    DWhy not this: nginx -V prints the version and build options; it does not check the configuration.

    nginx -t parses the configuration and reports syntax errors or success without applying anything to the running service. It is commonly run before systemctl reload nginx. It does not reload the configuration itself.

    Open this question
  31. Question 81

    Services and User Management

    While reviewing a server's configuration, an administrator finds a unit file named data-backup.mount in /etc/systemd/system. What does this file define?

    Show the answer

    Correct answerD. A filesystem mount point that systemd attaches at the location given in its Where= directive

    A .mount unit controls a filesystem mount point, using What=, Where= and Type= directives. A .target unit is the one that groups units into a synchronization state, which is the most tempting confusion here, but it does not mount filesystems.

    Open this question
  32. Question 82

    Services and User Management

    An administrator wants a script to run every night at 02:00 on a systemd-based server, replacing an old cron entry. The job is defined in backup.service. Which additional unit file should the administrator create so that systemd starts backup.service on that schedule?

    Show the answer

    Correct answerB. backup.timer containing an OnCalendar= directive

    A timer unit with OnCalendar= triggers its matching service at scheduled times, which replaces a cron entry. A path unit only reacts to filesystem changes, not to the clock, so it cannot run a job at 02:00.

    Open this question
  33. Question 83

    Services and User Management

    An administrator is troubleshooting DNS lookups on a host running systemd-resolved. Which four commands are valid resolvectl operations for this task? (Choose four.)

    Choose 4 answers

    Show the answer

    Correct answersA. resolvectl flush-cachesB. resolvectl statisticsC. resolvectl query example.comF. resolvectl status

    status, query, flush-caches and statistics are resolvectl subcommands for inspecting and managing the resolver. Setting the hostname and time zone belong to hostnamectl and timedatectl, not resolvectl.

    Open this question
  34. Question 84

    Services and User Management

    An administrator ran sysctl -w vm.swappiness=10 on a database server and performance improved, but after a reboot the value returned to 60. Which action makes the setting persistent across reboots?

    Show the answer

    Correct answerC. Put vm.swappiness=10 in /etc/sysctl.d/99-swap.conf, then run sysctl --system

    Files ending in .conf under /etc/sysctl.d/ are read at boot, and sysctl --system loads them immediately. Writing to /proc/sys changes only the running kernel, just as sysctl -w does, so the value is lost at reboot.

    Open this question
  35. Question 85

    Services and User Management

    A web server's nginx.service starts much later than expected during boot. The administrator wants terminal output showing the chain of units that nginx.service waited on, with the time at which each became active. Which command does this?

    Show the answer

    Correct answerC. systemd-analyze critical-chain nginx.service

    critical-chain shows the time-critical chain of units that gated the given unit's start. blame ranks units by their own initialization time and does not show the dependency path that delayed the service.

    Open this question
  36. Question 86

    Services and User Management

    After a kernel update, a server seems to boot more slowly. The administrator wants to see how the total boot time divides between the kernel and user space. Which command shows this?

    Show the answer

    Correct answerB. systemd-analyze time

    systemd-analyze time prints boot time split into firmware, loader, kernel and userspace phases. blame lists units by initialization time but does not show the kernel versus userspace split.

    Open this question
  37. Question 87

    Services and User Management

    A newly built server must keep its clock synchronized with NTP sources using the systemd-managed time synchronization service. Which command turns this on?

    Show the answer

    Correct answerC. timedatectl set-ntp true

    timedatectl set-ntp true enables network time synchronization. set-local-rtc only controls whether the hardware clock stores local time instead of UTC, so it does not start any synchronization.

    Open this question
  38. Question 88

    Services and User Management

    A security policy requires that cups.service must never run on a print-free server. It must not be started manually by an administrator or pulled in as a dependency of another unit. Which command BEST meets this requirement?

    Show the answer

    Correct answerC. systemctl mask cups.service

    Masking links the unit file to /dev/null, so systemd refuses to start it by any means, including manual starts and dependencies. Disable --now only removes the boot-time links and stops the running instance, so a manual start or a dependency can still launch it.

    Open this question
  39. Question 89

    Services and User Management

    A technician installs chronyd and wants it running immediately and also started at every boot, using a single command. Which command accomplishes this?

    Show the answer

    Correct answerA. systemctl enable --now chronyd.service

    The --now option makes enable also start the unit right away, so it covers both boot and the current session. The --runtime option is tempting, but it creates only temporary links that are lost at reboot, and it does not start the service.

    Open this question
  40. Question 90

    Services and User Management

    Which three actions require running systemctl daemon-reload before systemd uses the new configuration? (Choose three.)

    Choose 3 answers

    Show the answer

    Correct answersC. Creating a drop-in .conf file by hand under /etc/systemd/system/app.service.d/D. Copying a new unit file into /etc/systemd/systemF. Editing a unit file in /etc/systemd/system with a text editor

    Systemd caches unit definitions, so manual edits, hand-made drop-ins and newly copied unit files all need daemon-reload. systemctl edit already triggers a reload when you save, and an EnvironmentFile is read when the service starts, so a restart is enough.

    Open this question
  41. Question 91

    Services and User Management

    An administrator changes the ExecStart= line in /etc/systemd/system/reportd.service and runs systemctl restart reportd.service. The shell warns that the unit file changed on disk, and the service still runs the old command. What should the administrator do next?

    Show the answer

    Correct answerA. Run systemctl daemon-reload, then restart reportd.service again

    daemon-reload makes systemd re-read unit files from disk; a following restart then runs the new ExecStart. systemctl reload only signals the service to re-read its own application configuration and never re-reads the unit file.

    Open this question
  42. Question 92

    Services and User Management

    An administrator runs systemctl disable httpd while httpd is running. What is the state of the service afterward?

    Show the answer

    Correct answerA. It keeps running, but it will not start automatically at the next boot

    AWhy this is right: Disable removes the boot-time symlinks but leaves the running instance alone.

    BWhy not this: Stopping as well needs systemctl disable --now; plain disable does not stop the service.

    CWhy not this: disable does not stop the service, and it does remove the links that start it at boot.

    DWhy not this: Blocking manual starts is what mask does; a disabled unit can still be started by hand.

    Disable only removes the symlinks that start the unit automatically at boot or on activation of a target. The running process continues until stopped, unless the --now option is added to stop it as well.

    Open this question
  43. Question 93

    Services and User Management

    Which statement describes runC?

    Show the answer

    Correct answerA. A low-level OCI runtime that starts a container from a root filesystem bundle and config.json, without pulling images

    AWhy this is right: runC is the OCI reference runtime; it runs a bundle and leaves image handling to higher-level tools.

    BWhy not this: Pulling and storing images is the job of containerd, Podman or Docker, which call runC.

    CWhy not this: Scheduling across a cluster is what Kubernetes does; runC runs containers on one host.

    DWhy not this: Building images without a daemon describes Buildah; runC only runs containers.

    runC consumes an OCI bundle (root filesystem plus config.json) and starts the container. Image pulling and storage are handled by higher-level tools such as containerd, Podman or Docker.

    Open this question
  44. Question 94

    Services and User Management

    An administrator on a RHEL server must let developers run containers from their own unprivileged accounts. Policy forbids a persistent root-owned daemon, and the developers want a Docker-compatible command line. Which runtime BEST meets these requirements?

    Show the answer

    Correct answerB. Podman running in rootless mode

    Podman is daemonless, supports rootless containers, and offers a Docker-compatible CLI. Docker Engine is tempting for its CLI, but it depends on the dockerd daemon, which runs as root by default and breaks the policy.

    Open this question
  45. Question 95

    Services and User Management

    An engineer is building a Kubernetes node. It needs a minimal, CRI-capable daemon that pulls images, manages container lifecycle and snapshot storage, and delegates container creation to a low-level OCI runtime. It does not need image-build features. Which runtime BEST fits?

    Show the answer

    Correct answerB. containerd

    containerd is a high-level runtime daemon that handles image transfer, storage and lifecycle, and calls runC to create containers. runC is only the low-level runtime and does not pull images or manage storage itself.

    Open this question
  46. Question 96

    Services and User Management

    A security review finds that the processes in a container built from a custom Dockerfile run as root. The team wants the application to run as an unprivileged account named appuser that is created in the image. Which addition to the Dockerfile accomplishes this?

    Show the answer

    Correct answerA. USER appuser after a RUN useradd step

    The USER instruction sets the account for later build steps and for the container's running processes. ENV USER only sets an environment variable and does not change the effective user.

    Open this question
  47. Question 97

    Services and User Management

    What does docker image prune remove when it is run with no flags?

    Show the answer

    Correct answerA. Only dangling images, the untagged images listed as <none>

    AWhy this is right: With no flags, image prune removes only dangling images, the untagged <none> entries.

    BWhy not this: Removing all unused images, tagged ones included, needs the -a flag.

    CWhy not this: docker image prune never removes containers; docker container prune does that.

    DWhy not this: An age limit applies only with --filter until=, and the default ignores age.

    Without flags, docker image prune deletes only dangling images, which are untagged layers shown as <none>. Removing every image not used by a container requires the -a flag, and an age limit needs --filter until=.

    Open this question
  48. Question 98

    Services and User Management

    A compliance team requires every host to run byte-identical nginx image content, even if the maintainers later move a version tag to a rebuilt image. How should the image be referenced in docker pull?

    Show the answer

    Correct answerC. Use the image name followed by @sha256 and the image digest

    A digest identifies exact image content, so it cannot change. A version tag is tempting but is mutable: the maintainers can repoint it to a different image at any time.

    Open this question
  49. Question 99

    Services and User Management

    A developer wants a container that always starts the application with python app.py, while the default arguments --port 8080 can be replaced at run time, so that docker run myimg --port 9090 starts the app on port 9090. Which Dockerfile instructions achieve this?

    Show the answer

    Correct answerB. ENTRYPOINT ["python","app.py"] followed by CMD ["--port","8080"]

    ENTRYPOINT fixes the executable, and CMD supplies default arguments that arguments given to docker run replace. A lone CMD is replaced entirely, so --port 9090 would be run as the command and fail.

    Open this question
  50. Question 100

    Services and User Management

    A Dockerfile and its application files are in the current directory of a Linux server. An administrator must build an image from them and name it webapp with the tag 2.1. Which command does this?

    Show the answer

    Correct answerB. docker build -t webapp:2.1 .

    docker build reads the Dockerfile in the context directory (the trailing dot) and -t assigns the name and tag. The -f option is tempting but selects an alternate Dockerfile path, not the image name.

    Open this question