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

GC old dead containers and unused images #157

Closed
bgrant0607 opened this issue Jun 18, 2014 · 16 comments · Fixed by #3097 or #5569
Closed

GC old dead containers and unused images #157

bgrant0607 opened this issue Jun 18, 2014 · 16 comments · Fixed by #3097 or #5569
Assignees
Labels
priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/node Categorizes an issue or PR as relevant to SIG Node.
Milestone

Comments

@bgrant0607
Copy link
Member

As far as I can tell, we never call DELETE/RemoveContainer nor RemoveImage.

We should keep containers around for some amount of time for inspection, copying files out, etc., but should eventually clean them up.

We could treat images as a cache, evicting on LRU when we reach some predetermined space limit -- ideally before the disk just fills up.

@brendandburns
Copy link
Contributor

@roberthbailey will handle this one.

@bgrant0607
Copy link
Member Author

FYI, Docker is also contemplating GC of unreachable images:
https://botbot.me/freenode/docker-dev/2014-07-11/?msg=17856832&page=3

That shouldn't stop us from doing something, but we should prioritize complementary functionality.

@lavalamp lavalamp added the P1 label Aug 27, 2014
@lavalamp
Copy link
Member

Ping on this. It really makes things difficult when your stuff is crashlooping.

@roberthbailey
Copy link
Contributor

This is slowly percolating to the top of my TODO list. ETA to start on it is before end of the week.

@roberthbailey
Copy link
Contributor

I've written a small cli program that gets the output of ListContainers using the go docker remote api to see all of the dead and alive containers (this is the same output as 'docker ps -a'). Unfortunately, it looks like the only way to tell the status of a container is to use string parsing, as the status field is something like "Up 3 seconds" or "Exited (0) 53 minutes ago" rather than an actual type. This is going to be fragile.

@thockin
Copy link
Member

thockin commented Sep 4, 2014

You should be able to look at the 'inspect' output for each container, no?

"State": {
    "ExitCode": 0,
    "FinishedAt": "2014-08-12T05:52:38.116285958Z",
    "Paused": false,
    "Pid": 0,
    "Running": false,
    "StartedAt": "2014-08-12T05:52:36.592949946Z"
},

On Wed, Sep 3, 2014 at 3:16 PM, roberthbailey notifications@github.com
wrote:

I've written a small cli program that gets the output of ListContainers
using the go docker remote api to see all of the dead and alive containers
(this is the same output as 'docker ps -a'). Unfortunately, it looks like
the only way to tell the status of a container is to use string parsing, as
the status field is something like "Up 3 seconds" or "Exited (0) 53 minutes
ago" rather than an actual type. This is going to be fragile.

Reply to this email directly or view it on GitHub
#157 (comment)
.

@roberthbailey
Copy link
Contributor

That sounds much better than what I was seeing. Let me give it a try...

@brendandburns brendandburns modified the milestones: 0.7, v1.0 Sep 24, 2014
@bgrant0607
Copy link
Member Author

Is this being actively pursued? Should it be reassigned?

@roberthbailey
Copy link
Contributor

Not currently being pursued. Feel free to reassign.

@ryanleary
Copy link

This should be closed by #2022, yes?

@bgrant0607
Copy link
Member Author

@ryaneleary That only addressed containers, not images.

@dchen1107
Copy link
Member

I am reopening this issue since I believe #3097 doesn't address image gc issue. See #3264 for detail reasons. In a short version, current support of gc of image depending on docker's "dangling=true", which gives us proper unused images on a node. Instead it only returns a list of image layers without tag.

@dchen1107 dchen1107 reopened this Jan 8, 2015
This was referenced Jan 20, 2015
@dchen1107 dchen1107 added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Feb 4, 2015
@goltermann goltermann removed this from the v0.7 milestone Feb 6, 2015
@bgrant0607 bgrant0607 removed this from the v0.7 milestone Feb 6, 2015
@vmarmol
Copy link
Contributor

vmarmol commented Mar 13, 2015

Created #5457 and assigned to myself.

vmarmol added a commit to vmarmol/kubernetes that referenced this issue Mar 18, 2015
Integrated the imageManager into the Kubelet and applies the garbage
collection policy every 5 minutes. The default policy allows up to 90%
disk usage, after which images are garbage collected to bring limit back
down to 80%.

Fixes kubernetes#157.
akram referenced this issue in akram/kubernetes Apr 7, 2015
Integrated the imageManager into the Kubelet and applies the garbage
collection policy every 5 minutes. The default policy allows up to 90%
disk usage, after which images are garbage collected to bring limit back
down to 80%.

Fixes #157.
xingzhou pushed a commit to xingzhou/kubernetes that referenced this issue Dec 15, 2016
resouer pushed a commit to resouer/kubernetes that referenced this issue Jan 5, 2017
iaguis pushed a commit to kinvolk/kubernetes that referenced this issue Feb 6, 2018
seans3 pushed a commit to seans3/kubernetes that referenced this issue Apr 10, 2019
…stions

Add brief section about external dependencies
marun added a commit to marun/kubernetes that referenced this issue Jun 24, 2020
wking pushed a commit to wking/kubernetes that referenced this issue Jul 21, 2020
…tment_for_test_framework

No special treatment for test framework
Sn0rt pushed a commit to Sn0rt/kubernetes that referenced this issue Jan 7, 2021
Sn0rt pushed a commit to Sn0rt/kubernetes that referenced this issue Jan 7, 2021
…lop'

[feature] support emptydir kubernetes#157 kubernetes#172

See merge request whale/kubernetes!27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/node Categorizes an issue or PR as relevant to SIG Node.
Projects
None yet
10 participants