Skip to content

Instantly share code, notes, and snippets.

@klogic
Forked from koobitor/clear-docker-logs.md
Created October 9, 2018 06:28
Show Gist options
  • Save klogic/f66f22009827a57c7ad709907f16b755 to your computer and use it in GitHub Desktop.
Save klogic/f66f22009827a57c7ad709907f16b755 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

Here you can simply use output redirection to clear the log

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment