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

Upgrade dockerode and fix tagging wrong image #39

Closed
wants to merge 3 commits into from

Conversation

oba11
Copy link
Contributor

@oba11 oba11 commented Jun 5, 2017

Why

With the new docker api, there is an issue whereby once an image with latest tag is built, any image being built afterwards uses the image id of the previously built latest tag except the latest tagged-image is removed.

This was because var image = docker.client.getImage(imageId) used.
One new docker API servers, once the latest tagged-image is built, var image would default to latest image hub/repo:latest instead of hub/repo. On Cli try .

Steps to reproduce on cli

  • Remove all alpine images
  • docker pull alpine:3.5
    *docker image inspect alpine => You should get an error
  • docker pull alpine:latest
    *docker image inspect alpine => This should default to alpine:latest

The PR ensures that the images are tagged from the imageID instead of repo-name, then retrieves the image tag which is pushed to the registry

@@ -105,6 +106,9 @@ docker.buildImage = function(project, tarPath, imageId, buildId, buildLogger, do
}

buildLogger.info('[%s] %s', tag, result.stream || result.status);
if (result.stream && result.stream.indexOf('Successfully built ') == 0) {
realBuildId = result.stream.split('Successfully built ')[1].replace('\n', '');
Copy link
Contributor

Choose a reason for hiding this comment

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

this is very hack-ish, it's prone to error :) maybe check if dockerode provides other ways to give you the image name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't find a cleaner way around it. To avoid potential issue, did set the realBuildId as buildID as initial value.

@oba11
Copy link
Contributor Author

oba11 commented Jul 5, 2017

closing it to reopen the PR against master

@oba11 oba11 closed this Jul 5, 2017
@oba11 oba11 mentioned this pull request Jul 5, 2017
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.

2 participants