Skip to content
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

Add test/clean.sh script #639

Merged
merged 2 commits into from
Apr 3, 2015
Merged

Add test/clean.sh script #639

merged 2 commits into from
Apr 3, 2015

Conversation

md5
Copy link
Contributor

@md5 md5 commented Apr 3, 2015

Fixes #638

@tianon
Copy link
Member

tianon commented Apr 3, 2015

OMG when were wildcards implemented in docker images, and why didn't I notice??

@md5
Copy link
Contributor Author

md5 commented Apr 3, 2015

No idea, but I figured I'd test it to see if it worked. It's kind of surprising given that docker images image:tag and docker images ID don't work.

@tianon
Copy link
Member

tianon commented Apr 3, 2015

LGTM, but I'm still reeling from the fact that I somehow missed such a great feature that's clearly working in Docker 1.5.0!

@tianon
Copy link
Member

tianon commented Apr 3, 2015

So far, my digging shows it's been there since at least as far back as 1.2.0; still digging to see how deep this rabbit hole goes.

@tianon
Copy link
Member

tianon commented Apr 3, 2015

0.10.0 😳

@tianon
Copy link
Member

tianon commented Apr 3, 2015

This feature goes all the way back to Docker 0.6.2, and was added in moby/moby#1817.

@tianon
Copy link
Member

tianon commented Apr 3, 2015

BTW, the "trail" I followed to find that PR was graph/list.go, server/image.go, server/server.go, server.go (every file that line of code has moved through)

#!/bin/bash
set -e

docker images -q 'librarytest/*' | xargs docker rmi -f
Copy link
Member

Choose a reason for hiding this comment

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

Can we do a little changing here, to get rid of tags instead of images? Images will go away, but only if nothing else is using it.

docker images 'librarytest/*' | awk 'NR>1 { print $1":"$2 }' | xargs -r docker rmi

Copy link
Member

@tianon tianon Apr 3, 2015 via email

Choose a reason for hiding this comment

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

@md5
Copy link
Contributor Author

md5 commented Apr 3, 2015

Updated to only remove tags instead of images themselves. Too bad there isn't just a docker untag.

@md5
Copy link
Contributor Author

md5 commented Apr 3, 2015

Of course, this introduces another GNU-ism (xargs -r) that makes it impossible to run the official-images scripts easily under OS X.

@tianon
Copy link
Member

tianon commented Apr 3, 2015

OS X should just adopt the GNU 😺

@tianon
Copy link
Member

tianon commented Apr 3, 2015

(I'm OK with skipping the -r, but it does remove the docker: "rmi" requires a minimum of 1 argument. See 'docker rmi --help'. error nicely.)

@md5
Copy link
Contributor Author

md5 commented Apr 3, 2015

I love GNU, I really do, but I don't see OS X doing that. I should probably just go back to Linux.

I'll leave the xargs -r there since there are already readlink -f and a few other GNU-isms and Bash 4 things that make other scripts in this repo not work under OS X.

@tianon
Copy link
Member

tianon commented Apr 3, 2015

Ok, fair enough. ❤️

LGTM

@yosifkit
Copy link
Member

yosifkit commented Apr 3, 2015

LGTM

yosifkit added a commit that referenced this pull request Apr 3, 2015
@yosifkit yosifkit merged commit 151b596 into docker-library:master Apr 3, 2015
@md5 md5 deleted the test-clean-sh branch April 3, 2015 17:28
@md5
Copy link
Contributor Author

md5 commented Apr 3, 2015

I just realized this is going to choke if someone creates an image in the librarytest/* namespace without a tag. The awk command will return librarytest/foo:<none>, which will make docker rmi sad 😢

@md5
Copy link
Contributor Author

md5 commented Apr 3, 2015

Or perhaps Docker just doesn't allow what I'm saying, since it defaults to tagging as latest.

@tianon
Copy link
Member

tianon commented Apr 3, 2015 via email

@tianon
Copy link
Member

tianon commented Apr 3, 2015 via email

legolaz8451 pushed a commit to legolaz8451/official-images that referenced this pull request Mar 14, 2024
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.

Implement cleanup for "librarytest/*" images after tests complete
3 participants