Preface
Hello there!
I've done some googling and I have not seen any clear documentation or discussion about this aspect of the docker image prune command.
I've read a fair amount of the documentation here:
Problem
There appears to be no mechanism for filtering on information specific to the image name and/or tags.
User Story
I have a build process that builds intermediate images for my process. In addition to that I'm also pulling in other images from a docker registry, and this machine may be dirty from the build system using other build processes docker images.
Because of this I would like to be able to filter out images/tags that are irrelevant and/or relevant to my images.
For example, my docker images after the process is run, looks like so:
REPOSITORY TAG IMAGE ID CREATED SIZE
example.com/releng/api-db latest f19d60cab35c 6 days ago 281MB
example.com/releng/worker latest 7fe81bdeb5d2 6 days ago 921MB
example.com/releng/api latest 5152cade7311 6 days ago 921MB
example.com/example_product/api latest-development de17f92e5504 7 days ago 333MB
rabbitmq 3-management 046c07b70859 7 days ago 124MB
dinkel/clamavd latest 9a42e4755eb9 7 days ago 361MB
example.com/example_product/worker latest-development f57aab6d0d61 8 days ago 378MB
example.com/example_product/standalone latest 8ac468f8a86f 2 weeks ago 2.25GB
example.com/example_product/halifax latest-development b7cbf1bda847 3 weeks ago 475MB
example.com/postgres 9.4 68c55c797542 5 weeks ago 263MB
ubuntu latest ccc7a11d65b1 2 months ago 120MB
redis 3.0.7 c44fa74ead88 3 months ago 91.6MB
nginx 1.12.0 313ec0a602bc 3 months ago 107MB
example.com/example_product/postgres latest-development 4eb1ac130d39 6 months ago 265MB
python 2.7.12 0900c636e10d 10 months ago 676MB
Hypothetical Solution
What would be super convenient is the ability to filter based on the image name, the repo that houses the images, and/or the ability to filter by tags as well within that context.
Let's pretend I want to remove all images retrieved from the example.com repo.
Remove images based on repo fuzzy matching
docker image prune --force --filter "repository=example.com*"
Or maybe I want it based on image name
Remove images based on image name fuzzy matching
docker image prune --force --filter "repository=*example_product*"
Questions
Am I misunderstanding the --filter flag?
I realize grep'ing is a solution, but this seems like the tool itself would benefit more from creating this feature rather than relying on work arounds from within the environment's tooling?
I look forward to your feedback 😄
Output of docker version:
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: darwin/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:45:38 2017
OS/Arch: linux/amd64
Experimental: true
Output of docker info:
Containers: 8
Running: 0
Paused: 0
Stopped: 8
Images: 48
Server Version: 17.09.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 140
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: moby
ID: TERQ:LFYT:CWRT:4ZPB:37GA:BEWW:265O:6Q35:6DCW:6ISX:OMI2:2EQ7
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 19
Goroutines: 31
System Time: 2017-10-18T00:08:35.693503549Z
EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.):
OSX
Preface
Hello there!
I've done some googling and I have not seen any clear documentation or discussion about this aspect of the
docker image prunecommand.I've read a fair amount of the documentation here:
Problem
There appears to be no mechanism for filtering on information specific to the image name and/or tags.
User Story
I have a build process that builds intermediate images for my process. In addition to that I'm also pulling in other images from a docker registry, and this machine may be dirty from the build system using other build processes docker images.
Because of this I would like to be able to filter out images/tags that are irrelevant and/or relevant to my images.
For example, my docker images after the process is run, looks like so:
Hypothetical Solution
What would be super convenient is the ability to filter based on the image name, the repo that houses the images, and/or the ability to filter by tags as well within that context.
Let's pretend I want to remove all images retrieved from the example.com repo.
Remove images based on repo fuzzy matching
docker image prune --force --filter "repository=example.com*"Or maybe I want it based on image name
Remove images based on image name fuzzy matching
docker image prune --force --filter "repository=*example_product*"Questions
Am I misunderstanding the
--filterflag?I realize grep'ing is a solution, but this seems like the tool itself would benefit more from creating this feature rather than relying on work arounds from within the environment's tooling?
I look forward to your feedback 😄
Output of
docker version:Output of
docker info:Additional environment details (AWS, VirtualBox, physical, etc.):
OSX