The Docker daemon requires adequate space to write to
/var/lib/docker before it can start/restart successfully. If the daemon is unable to start due to a "No space left on device" error, the following process can be used to remove large container log files to free disk space.
To successfully remove large container log files, to clear space for the Docker daemon, use these steps:
/var/lib/docker/containersdirectory to show which container directories have the largest log files:
du -d1 -h /var/lib/docker/containers | sort -h
The output of this command lists the container directories, regarding container log size, in ascending order.
2a. Clear the contents of the container log file that you choose:
``` cat /dev/null > /var/lib/docker/containers/container_id/container_log_name ``` This command results in a zero size log file.
2b. If sudo is required to run the above command, please use the following to prevent any 'permission denied' errors:
``` sudo sh -c "cat /dev/null > /var/lib/docker/containers/container_id/container_log_name"