Skip to content

Enable the Docker service

An XCCDF Rule

Description

The docker service is commonly needed to create containers. The docker service can be enabled with the following command:

$ sudo systemctl enable docker.service

Rationale

To be able to find any problems with misconfiguration of the docker daemon and running containers, the docker service has to be enabled.

ID
xccdf_org.ssgproject.content_rule_service_docker_enabled
Severity
Medium
Updated



Remediation - Ansible

- name: Enable service docker
  block:

  - name: Gather the package facts
    package_facts:
      manager: auto

Remediation - Puppet

include enable_docker

class enable_docker {
  service {'docker':
    enable => true,
    ensure => 'running',

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then

SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" unmask 'docker.service'
"$SYSTEMCTL_EXEC" start 'docker.service'

Remediation - OS Build Blueprint


[customizations.services]
enabled = ["docker"]