Skip to content

Instantly share code, notes, and snippets.

@klogic
Forked from koobitor/clear-docker-logs.md
Last active November 20, 2018 03:24
Show Gist options
  • Save klogic/59272063c7284fabc42b1f62148ec211 to your computer and use it in GitHub Desktop.
Save klogic/59272063c7284fabc42b1f62148ec211 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 /Users/<username>/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

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