skip to Main Content

Background

After purging Docker containers cache (/var/lib/docker/overlay2) that has grown to 3 TB I had to also purge everything to do with Docker and Containerd (using this answer and most of its comments), because Docker CLI has become impossible to use. After re-installing Docker components using the official docs) I cannot start Docker service using standard methods (i.e. sudo systemctl [re]start docker) because it raises this error:

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.

What I found

The only workaround I’ve found is to start Docker Daemon manually (e.g. sudo dockerd --debug &). Debug info printed by the Docker Daemon does not show anything special.

Debug info

$ systemctl status docker.service 
× docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/docker.service.d
             └─version.conf
     Active: failed (Result: exit-code) since Thu 2024-03-21 11:57:51 UTC; 13min ago
TriggeredBy: × docker.socket
       Docs: https://docs.docker.com
    Process: 56625 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
   Main PID: 56625 (code=exited, status=1/FAILURE)
        CPU: 69ms

$ sudo journalctl -xeu docker.service
 21 12:19:05 build-srv-3-fi dockerd[123185]: invalid DOCKER_MIN_API_VERSION: minimum supported API version is 1.24: 1.22
Mar 21 12:19:05 build-srv-3-fi systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ An ExecStart= process belonging to unit docker.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Mar 21 12:19:05 build-srv-3-fi systemd[1]: docker.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ The unit docker.service has entered the 'failed' state with result 'exit-code'.
Mar 21 12:19:05 build-srv-3-fi systemd[1]: Failed to start Docker Application Container Engine.
░░ Subject: A start job for unit docker.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit docker.service has finished with a failure.
░░ 
░░ The job identifier is 3045 and the job result is failed.

Question/reason

How to restore the standard Docker service startup method using systemctl? It is needed for several reasons, and especially for re-activating this workaround currently needed by Skopeo used by Anchore Grype.

2

Answers


  1. Just as the Daemon told you:

    invalid DOCKER_MIN_API_VERSION: minimum supported API version is 1.24: 1.22

    Your installed Version is 1.22 and it is not 1.24

    Or if you just need a quick and dirty workaround for your "skopeo" than follow this link: https://github.com/containers/skopeo/issues/2202#issuecomment-1908830671
    And use his workaround.

    Login or Signup to reply.
  2. The error message you are seeing suggests that there is an erroneous DOCKER_MIN_API_VERSION setting, which is the reason why the Docker service failed to start. The error notice makes it clear that while the current value is 1.22, which is not supported, the minimum supported version of the API is 1.24.

    You must upgrade the DOCKER_MIN_API_VERSION environment variable to a supported version, like 1.24 or above, in order to fix this problem. You can accomplish this by either changing the environment variable in your system’s environment or by altering the Docker service configuration file.

    The DOCKER_MIN_API_VERSION environment variable can be updated as follows:

    Modify the configuration file for the Docker service:
    Using a text editor, open the Docker service configuration file at /etc/systemd/system/docker.service.d/version.conf. It may require sudo to alter this file.

    Find the line that sets the environment variable DOCKER_MIN_API_VERSION and change it to a version that is supported, such 1.24.

    After saving the file, close the text editor.
    In the environment of your system, set the environment variable:
    Access the environment variables file on your PC. Depending on how your system is configured, this could be ~/.bashrc, ~/.profile, or ~/.bash_profile.
    To set the DOCKER_MIN_API_VERSION environment variable to a supported version, add the following line:

    export 1.24 is the Docker Min API Version.
    

    After saving the file, close the text editor.
    Run source ~/.bashrc in your terminal, or the relevant file you updated, to apply the changes.

    To implement the modifications, restart the Docker service after modifying the DOCKER_MIN_API_VERSION environment variable:

    sudo systemctl restart docker.service 
    sudo systemctl daemon-reload
    

    Verify that the Docker service is operating error-free by checking its status once more:

     sudo systemctl docker.service status
    

    The problem ought to be fixed if the service launches without any problems. If you’re still having issues, you might want to look through the Docker documentation or contact the official support channels or community forums for assistance.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search