Skip to content

Instantly share code, notes, and snippets.

@koobitor
Last active December 13, 2018 01:44
Show Gist options
  • Save koobitor/0ca58294671b8eeed5c172ad88a61b36 to your computer and use it in GitHub Desktop.
Save koobitor/0ca58294671b8eeed5c172ad88a61b36 to your computer and use it in GitHub Desktop.

Docker daemon runs in a separate VM, so in order to clear logs you should do the following steps:

First, you can find the log path inside the VM, with:

docker inspect --format='{{.LogPath}}' NAME|ID

You can connect to the VM with screen

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty

Here you can simply use output redirection to clear the log

rm -Rf /var/lib/docker/containers/CONTAINER_ID/CONTAINER_ID-json.log
rm -Rf /var/lib/docker/containers/*/*-json.log

And finally you can detach the screen with hitting Control + a d

Ubuntu remove docker logs

cd /var/lib/docker
find /var/lib/docker/containers/ -type f -name "*.log" -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment