-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Really clean-up containers and images a-la-Docker #967
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
Conversation
- Use docker ps to filter containers by status to avoid building such a long pipe.
- Images cleanup is a common practice taken from https://docs.docker.com/reference/commandline/cli/#filtering_1
dokku
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the sudo here? I think you can remove it.
Be careful, when there is no image to delete, you will have an error (not shown here, be the exit status will not be 0)
I use this in one of my script:
remove exited containers
exited_containers=$(docker ps -a -q -f status=exited)
[[ -z "$exited_containers" ]] || docker rm $exited_containers &> /dev/null &
remove dangling images
dangling_images=$(docker images -q -f dangling=true)
[[ -z "$dangling_images" ]] || docker rmi $dangling_images &> /dev/null &
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the sudo thing, was just cruft leftover.
Be careful, when there is no image to delete, you will have an error
The same would happen with the old version too. BTW, your 2-liners look fine to me.
dokku
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Tue, Feb 10, 2015 at 2:14 PM, Michael Hobbs notifications@github.com wrote:
In dokku:
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+7#!/usr/bin/env bashTypo?
Yep
Alessio Treglia | www.alessiotreglia.com
Debian Developer | alessio@debian.org
Ubuntu Core Developer | quadrispro@ubuntu.com
0416 0004 A827 6E40 BB98 90FB E8A4 8AE5 311D 765A
|
Would be great to have a unit test for cleanup. |
|
@alessio bump for unit test :) |
|
@michaelshobbs Do these tests look good to you? |
|
Hmm I wonder why tests didn't trigger here... |
|
👍 on the tests. I think @alessio will need to follow his fork on CircleCI to make the tests run. |
|
@progrium Can you turn on pull request support for dokku? This is the message I got from CircleCI support:
|
|
Mmmmm... I'd really like to avoid it. Might want to put secrets on CircleCI On Thu, Feb 19, 2015 at 12:52 PM, Jose Diaz-Gonzalez <
Jeff Lindsay |
|
We don't currently have secrets - feel free to correct me @michaelshobbs - and I don't think our testing infra needs them anymore (the old travis stuff did). We can always disable if we ever do. |
|
I can think of a time in the not so distant future when we might. And I On Thu, Feb 19, 2015 at 1:23 PM, Jose Diaz-Gonzalez <
Jeff Lindsay |
|
I guess it was just PRs from @michaelshobbs and myself. Maybe its just me, but the value of having contributors write tests decrease if they don't get those tests run. And having them turn on an extra knob increases friction to contributing, so I'm torn. Is there an example where we'd want to have secrets in our circleci setup? |
Really clean-up containers and images a-la-Docker
No description provided.