Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker prune guidance to the troubleshooting guide #24

Open
Tracked by #202
kdmccormick opened this issue Oct 12, 2022 · 4 comments
Open
Tracked by #202

Add docker prune guidance to the troubleshooting guide #24

kdmccormick opened this issue Oct 12, 2022 · 4 comments
Labels
documentation Relates to documentation improvements good first issue A good task for a newcomer to start with tutor Requires a change to Tutor

Comments

@kdmccormick
Copy link
Member

Context

After using Tutor for a while (especially, after using different versions of it and/or using it alongside Devstack), it is common for one's Docker build cache (on Linux, /var/lib/docker) to become very large. Like, tens of gigabytes. After a while, this can fill up the developer's disk, causing a variety of strange system-wide problems.

There is a very simple solution to this problem: pruning. In particular, it is good to run the following every month or so:

tutor ... start        # start Tutor so that the images you need are considered "in use"
docker system prune -a # deletes every container and image that isn't in use

This can free up dozens of gigabytes of disk space.

Acceptance Criteria

Add this information to the troubleshooting guide in the official docs: https://docs.tutor.overhang.io/troubleshooting.html

@regisb
Copy link
Contributor

regisb commented Oct 17, 2022

I suggest to clear only the oldest images:

docker image prune --all --force --filter until=72h

@kdmccormick kdmccormick added good first issue A good task for a newcomer to start with and removed good first issue A good task for a newcomer to start with labels Jan 5, 2023
@ARMBouhali
Copy link

ARMBouhali commented Jan 6, 2023

@regisb @kdmccormick it appears docker uses image creation time for the until filter rather than last used time;
I think we need to employ an LRU cache eviction policy.

I found this tinteresting tool which does the LRU part, so I am adding it to the discussion
https://github.com/stepchowfun/docuum

@regisb
Copy link
Contributor

regisb commented Feb 7, 2023

@ARMBouhali I followed your suggestion and started using docuum on my CI server a couple weeks ago. So far it's working great! Here's my docker-compose.yml:

services:
  docuum:
    image: docker.io/stephanmisc/docuum:latest
    init: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data/docuum:/root/.local/share/docuum
    command: "--threshold=100GB"
    restart: unless-stopped

This would make a great contrib plugin ;)

@ARMBouhali
Copy link

ARMBouhali commented Feb 7, 2023

Thanks, @regis. that's a very elegant solution! It never crossed my thought to use a docker container to handle docker's own problems.

With this discovery, I can qualify the issue as solved. But maybe there is more to it.

One of my struggles with docker is when the cache build accumulate, and there's no easy way to achieve selective pruning, and there is no clear feedback using docker image prune. Something like a tool (not necessarily a plugin) that can feed on tutor's build configuration might be the solution to achieve ideal selective pruning. That's more work to do and I'm not sure if it's worth it in the long run.

@kdmccormick kdmccormick added the documentation Relates to documentation improvements label May 31, 2023
@kdmccormick kdmccormick transferred this issue from openedx-unsupported/wg-developer-experience Mar 28, 2024
@kdmccormick kdmccormick added the tutor Requires a change to Tutor label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Relates to documentation improvements good first issue A good task for a newcomer to start with tutor Requires a change to Tutor
Projects
No open projects
Status: Refined
Development

No branches or pull requests

3 participants