Coder Social home page Coder Social logo

Comments (7)

vi7 avatar vi7 commented on August 14, 2024

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.

jnjackins avatar jnjackins commented on August 14, 2024

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.

jnjackins avatar jnjackins commented on August 14, 2024

Have you run docker-cleanup with DEBUG enabled?

from docker-cleanup.

mattdodge avatar mattdodge commented on August 14, 2024

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.

seandtaber avatar seandtaber commented on August 14, 2024

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.

CodingContraption avatar CodingContraption commented on August 14, 2024

@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.

rasjoh avatar rasjoh commented on August 14, 2024

Won't fix due to retiring project

from docker-cleanup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.