nerdexam
CompTIA

XK0-005 · Question #663

A Linux administrator has defined a systemd script docker-repository.mount to mount a volume for use by the Docker service. The administrator wants to ensure that Docker service does not start until…

The correct answer is C. Requires=docker-repository.mount. 'Requires=docker-repository.mount' in the Docker service unit file creates a hard dependency: if the mount unit fails to start, systemd will also fail the Docker service. This is stronger than 'After=' alone, which only controls ordering but does not enforce a dependency…

System Management

Question

A Linux administrator has defined a systemd script docker-repository.mount to mount a volume for use by the Docker service. The administrator wants to ensure that Docker service does not start until the volume is mounted. Which of the following configurations needs to be added to the Docker service definition to best accomplish this task?

Options

  • AAfter=docker-respository.mount
  • BExecStart=/usr/bin/mount -a
  • CRequires=docker-repository.mount
  • DRequiresMountsFor=docker-repository.mount

How the community answered

(26 responses)
  • A
    12% (3)
  • B
    8% (2)
  • C
    77% (20)
  • D
    4% (1)

Explanation

'Requires=docker-repository.mount' in the Docker service unit file creates a hard dependency: if the mount unit fails to start, systemd will also fail the Docker service. This is stronger than 'After=' alone, which only controls ordering but does not enforce a dependency (Docker could still start even if the mount failed). 'ExecStart=/usr/bin/mount -a' mounts all filesystems in fstab but is not the right mechanism for unit dependencies. 'RequiresMountsFor=' is used to require that a given path be mounted, specified by path rather than unit name.

Topics

#systemd#service management#unit dependencies#mount units

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice