Skip to content

check if the image is locally, otherwise pull it #22

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

Merged
merged 1 commit into from
Sep 23, 2014

Conversation

jfromaniello
Copy link
Contributor

With this change it will work similar to docker run command.

If the image is not locally it will pull it.

@jaredly
Copy link
Member

jaredly commented Sep 23, 2014

awesome

jaredly added a commit that referenced this pull request Sep 23, 2014
check if the image is locally, otherwise pull it
@jaredly jaredly merged commit e611a95 into Strider-CD:master Sep 23, 2014
if (err) return done(err);

var found = images.some(function (img) {
return ~img.RepoTags.indexOf(fullname);
Copy link
Member

Choose a reason for hiding this comment

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

that ~ is too clever :P i had to google this. learn something new everyday...

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I personally really don't like it because it obscures the logic....

Copy link
Member

Choose a reason for hiding this comment

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

let's make it clearer next time we're working in the file, i think it's fine for now -- anyone seriously looking at this code is gonna google and learn

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I agree with @jaredly, but at the same time my brain reads ~....indexOf(x) as contains. Because I've read a lot of javascript and node modules and it is a very common trick.

I hope this succeed domenic/Array.prototype.contains some day.

@jfromaniello
Copy link
Contributor Author

To be honest, I don't understand why this is so hard with dockerode, the run command from the cli automatically fetch the image. Seems, that's not the case with the remote api

@kfatehi
Copy link
Member

kfatehi commented Sep 23, 2014

@jfromaniello the docker remote api is just way more granular than the docker cli. dockerode does a fantastic job wrapping the api in my opinion

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.

3 participants