Skip to content

Add general topic about pruning objects#4089

Merged
mdlinville merged 1 commit into
docker:masterfrom
mdlinville:add-pruning-topic
Aug 4, 2017
Merged

Add general topic about pruning objects#4089
mdlinville merged 1 commit into
docker:masterfrom
mdlinville:add-pruning-topic

Conversation

@mdlinville
Copy link
Copy Markdown

Fixes #4000

I needed to document that volumes are not automatically pruned by docker system prune anymore as of 17.06.1, and I realized we don't have a general topic about pruning objects, so I wrote one. This is against master since the behavior change is actually in 17.06.1 and 17.07.0.

@mdlinville mdlinville added this to the engine/17.07 milestone Aug 3, 2017
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Left some comments

Comment thread engine/admin/pruning.md Outdated

The `docker image prune` command allows you to clean up unused images. By
default, `docker image prune` only cleans up _dangling_ images. A dangling
image is one that is not tagged and is not referenced by any running container.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove running here, stopped containers also count

Comment thread engine/admin/pruning.md Outdated
When you stop a container, it is not automatically removed unless you started
it with the `--rm` flag. To see all containers on the Docker host, including
stopped containers, use `docker ps -a`. You may be surprised how many containers
exist, especially on a development system! A stopped container's read-only and
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the read-only layers are not removed (the read-only layers are what makes up an "image")

Comment thread engine/admin/pruning.md Outdated

By default, all unused volumes are removed. You can limit the scope using
the `--filter` flag. For instance, the following command only removes
volumes older than 24 hours:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

volumes don't (yet) support the until filter, you could use an example using labels, e.g.

prune all volumes that don't have the "keep" label;

docker volume prune --filter label!=keep

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the label filter is supported by all object types)

Comment thread engine/admin/pruning.md Outdated
objects older than 24 hours:

```bash
$ docker system prune --filter "until=24h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the label filter here; the "until" filter cannot be used with volumes, so will produce an error; docker-archive/docker-ce#154

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also discussion about the validity of filters on "system prune"; docker/cli#311 (comment) (perhaps we should remove the filtering section here altogether)

Comment thread engine/admin/pruning.md Outdated
@@ -0,0 +1,187 @@
---
description: Pruning unused objects
keywords: pruning, prune, images, volumes, containers, networks, disk, administration
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have "garbage collection", "garbage collection" as keyword.

Perhaps even use it in the title ("Garbage collecting - pruning unused Docker objects")

Copy link
Copy Markdown
Contributor

@londoncalling londoncalling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mstanleyjones approved after addressing @thaJeztah 's comments

@mdlinville
Copy link
Copy Markdown
Author

Addressed feedback.

@mdlinville mdlinville dismissed thaJeztah’s stale review August 4, 2017 21:59

Feedback addressed.

@mdlinville mdlinville merged commit f97da2c into docker:master Aug 4, 2017
@mdlinville mdlinville deleted the add-pruning-topic branch August 4, 2017 21:59
shin- pushed a commit to shin-/docker.github.io that referenced this pull request Aug 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants