Comments (7)
Hi @mattdodge ! We are using pretty much the same setup and facing same kind of problems.
Specifically with Jenkins stack provided by the Rancher catalog
I've checked checkPatterns
func in the run.sh and from my understanding it cannot filter out and protect containers by the *:*
as well as the images with tag latest
as far as image names in that case are reported without :latest
.
busybox
image used in the Jenkins stack from Rancher is a good example of that, you can try docker inspect --format='{{(index .Config.Image)}}' <jenkins-datavolume-container-id>
and check the output
from docker-cleanup.
I believe the expected behavior is that the container will be kept if at least one of the KEEP_CONTAINERS or KEEP_CONTAINERS_NAMED conditions match. So it must be the case that either a) these containers do no match either rule, or b) there is a bug.
In your case, no containers will ever match **None**
. What is the image name of the containers being destroyed?
from docker-cleanup.
Have you run docker-cleanup with DEBUG enabled?
from docker-cleanup.
I would also expect that to be an OR
operation, that didn't seem to be the case though. Haven't run with DEBUG
and I don't have the original container names but this is what it is named now so should be close. These are the details of the container that was incorrectly getting cleaned up.
Image: 123456789012.dkr.ecr.us-west-2.amazonaws.com/vault-data
Container Name: API-vault-vault-data-1
I've anonymized our AWS/ECR ID in the image URL but it's numbers just like that. We've since changed our config to KEEP_CONTAINERS_NAMED = *vault*
from **None**
and it is correctly keeping the container now. I can do some more testing later today too if needed.
from docker-cleanup.
Hi @mattdodge thanks for that info! If you could run some more testing, possibly with DEBUG enabled that would assist us in troubleshooting this issue.
from docker-cleanup.
@mattdodge The details you provided basically answer your question: the image name does not match the pattern *:*
. images that are started with an implicit latest
tag, come back without the tag by the docker inspect --format='{{(index .Config.Image)}}' $CONTAINER_ID
command that is used in the script.
Example:
saydocker run hello-world
starts with container id 1
and docker run hello-world:latest
starts with container id 2
docker inspect --format='{{(index .Config.Image)}}' 1
returns hello-world
docker inspect --format='{{(index .Config.Image)}}' 2
returns hello-world:latest
Only hello-world:latest
will match with the *:*
pattern.
The solution:
Use **All**
or .
to match everything including implicit latest
tagged images. (**All**
is translated to .
: source)
I think the readme should be updated to reflect this behaviour.
from docker-cleanup.
Won't fix due to retiring project
from docker-cleanup.
Related Issues (20)
- allow non-looped cleanups HOT 4
- Wrong Docker version on host HOT 9
- License HOT 1
- Janitor deletes data only containers and images HOT 5
- Unable to clean same unused images from multiple repositories HOT 8
- Permission denied? HOT 1
- should use `docker volume rm`
- cannot unmarshal object into Go value of type []string HOT 5
- Use labels instead of container names HOT 1
- Why not use docker commands with clean-up jenkins job? **Not a issue - just a thought**
- KEEP_VOLUMES HOT 2
- Limit disk usage with LRU HOT 1
- Does not remove images without -f parameter for docker rmi command HOT 2
- Avoid mounting /var/lib/docker directory from host HOT 1
- image cleanup based on created time HOT 1
- Script attempts to remove non-local docker volume (noop, but still) HOT 2
- Tag suggestion for Docker Hub project HOT 1
- Allow wildcards in exclude list HOT 4
- Support for overlay HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-cleanup.