Skip to content

Support for identitytoken auth type #293

Closed

Description

@peter-evans

Issue found when attempting to run the test in the spring boot example here:
https://github.com/testcontainers/testcontainers-java-examples/tree/master/spring-boot

Environment

  • Ubuntu 16.04
  • docker 1.13.1
  • IntelliJ IDEA

This is the output from executing the maven test phase: build_output.txt

I verified the version by adding the following dependency to the pom.xml

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <version>1.1.9</version>
        </dependency>

@bsideup identified issue #270 as the possible cause.

After testing with version 1.1.7 the test passed. So it's likely a regression caused by the above issue.

Just an extra detail. After the test passed using version 1.1.7 I recompiled with 1.1.9 and the test passed. I had to manually delete the redis image to cause the error to occur again. So if you already have the required image in your local environment you may need to remove it to reproduce.

Activity

  1. added this to the milestone on Feb 17, 2017
  2. peter-evans commented on Feb 18, 2017

    @peter-evans
    ContributorAuthor

    When I found this issue I was testing on a machine that has a ~/.docker/config.json file present. I believe this file is used to store auth details for private repositories.

    I just tried to reproduce the issue on another machine with the exact same environment. The only difference is that this machine does not have a ~/.docker/config.json file present. The test passed fine with version 1.1.9.

  3. rnorth commented on Feb 18, 2017

    @rnorth
    Member

    Hi @peter-evans
    Sorry - that's very odd. Could you possibly share the ~/.docker/config.json file as well (please do mask out any sensitive values, though!)

    This will probably help reproduce and also identify if there are any edge cases for parsing that need to be handled upstream in docker-java. @tourea might be interested to know about this if there is anything!

    Richard

  4. peter-evans commented on Feb 20, 2017

    @peter-evans
    ContributorAuthor

    Hi @rnorth

    This is the file: config.json.txt

    Except for the following two actions to mask sensitive details everything in the file is unchanged.

    • Added asterisks to partially mask values
    • Replaced my real company name with companyname

    There is one entry in the file for a company internal docker registry. All the other entries have presumably been inserted by the Google Cloud SDK.

  5. peter-evans commented on Feb 20, 2017

    @peter-evans
    ContributorAuthor

    I noticed that the entry in the file for my company's internal docker registry is different. It uses identitytoken instead of email.

    Removing that one entry from the file allows the file to be parsed and the spring boot project test passes with version 1.1.9. It seems likely that the parsing code for config.json isn't taking into account the identitytoken format.

    The product my company is using is the Docker Datacenter. It comes with the Docker Trusted Registry component, which I believe is using the identitytoken format.

    Update: Docker Datacenter has been re-branded Docker Enterprise Edition.

  6. rnorth commented on Mar 3, 2017

    @rnorth
    Member

    @peter-evans Sorry for the slow response.
    It looks like that field isn't supported in docker-java's AuthConfig DTO. I'm not sure why the changes to support registry v2 format broke things, though. Is it possible that 1.1.7 was working for you because docker-java ignored your registry config, whereas now it's trying and failing to parse it?

    We'll need to look into this further.

  7. peter-evans commented on Mar 3, 2017

    @peter-evans
    ContributorAuthor

    @rnorth Yes, I believe that is why version 1.1.7 was working. Before this change docker-java didn't support config.json and so didn't attempt to parse it.

    I think you are right about that AuthConfig DTO. The Docker Trusted Registry, which is a component of the newly branded Docker Enterprise Edition, is the official commercial offering from Docker, so it really should support it.

  8. peter-evans commented on Mar 5, 2017

    @peter-evans
    ContributorAuthor

    Spotify's docker-client also had the same issue and it seems to have been fixed recently here with an update here. That fix might help as a reference.

  9. modified the milestones: 1.3.0, 1.2.0 on Mar 13, 2017
  10. removed this from the 1.3.0 milestone on Jun 5, 2017
  11. mabn commented on Jun 30, 2017

    @mabn

    I have similar problem - parsing fails when config.json contains "credsStore".

    There was an issue for this in docker-java (docker-java/docker-java#806) and it's fixed, but new version wasn't released yet. It will be included in docker-java 3.0.12.

  12. email2liyang commented on Jul 15, 2017

    @email2liyang

    I have the same issue when I try to use version 1.3.1

  13. bsideup commented on Jul 26, 2017

    @bsideup
    Member

    Hi @peter-evans, @mabn, and @email2liyang,

    we just released 1.4.2, it should fix the issue, could you please try it? Thanks!

  14. 3 remaining items

  15. nowheresly commented on Aug 15, 2018

    @nowheresly

    I have the same issue with the unrecognized identitytoken.
    A PR has just been merged in project docker-java to solve this (docker-java/docker-java#1004).
    I think this issue could be closed as soon as the new release of docker-java with the fix is available is used.

  16. changed the title [-]"Failed to parse dockerCfgFile" Issue[/-] [+]Support for identitytoken auth type[/+] on Aug 16, 2018
  17. rnorth commented on Aug 16, 2018

    @rnorth
    Member

    Thanks @nowheresly - will watch out for that being released.

  18. majusmisiak commented on Sep 4, 2018

    @majusmisiak

    @nowheresly are you aware of reliable workaround, until this issue is fixed in the upstream (other than removing "identitytoken": ... from ~/.docker/config.json)? Even with image pull disabled like:

        @Rule
        public RuleChain chain = RuleChain
                .outerRule(new DockerComposeContainer(new File(dockerComposeFile))
                        .withLocalCompose(true)
                        .withPull(false));

    it is still failing with org.testcontainers.shaded.com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.

    Should the config be read, if pulling is disabled?

  19. nowheresly commented on Sep 4, 2018

    @nowheresly

    Hi @majusmisiak , unfortunately, my current workaround consist in remove the identityToken (by calling docker logout).
    In fact the fix is located in only one class of docker-java project. Maybe if you try to put the correct version of the AuthConfig class somewhere in your classpath so that it takes precedence over the official one inside the docker-java jar, it may help.
    The correct version of the class can be found here in this PR docker-java/docker-java#1083

  20. majusmisiak commented on Sep 5, 2018

    @majusmisiak

    Hi @nowheresly, patching this single class directly solved the problem. I used AuthConfig.java directly from master (sha1 153e06a4) with testcontainers:core 1.8.3 and testcontainers:docker-compose 0.9.9.

    This seems more portable workaround than removing "identitytoken: ..., since I can run it as-it-is on any build server.

    Many thanks, now awaiting docker-java 3.1.0 release.

  21. bsideup commented on Sep 5, 2018

    @bsideup
    Member

    @majusmisiak have you tried running the code from #845 PR?
    If not, could you please? @rnorth is currently testing it and any feedback will help 👍

  22. majusmisiak commented on Sep 6, 2018

    @majusmisiak

    @bsideup it will give it a spin locally and add comment on PR if I come up with anything useful for you.

  23. rnorth commented on Sep 7, 2018

    @rnorth
    Member

    I think we'll probably need to bump up to docker-java 3.1.0-rc4 to benefit from that PR. I think that would be worth including in #845...

  24. bsideup commented on Sep 7, 2018

    @bsideup
    Member

    @rnorth yes, upgrading docker-java is a good idea 👍

  25. nowheresly commented on Sep 7, 2018

    @nowheresly

    I agree as well since this bug is really annoying.

  26. rnorth commented on Sep 10, 2018

    @rnorth
    Member

    We updated docker-java in #845 on Friday.

    We have this out in a Release Candidate build (1.9.0-rc1) for anyone who is keen to try it!

    Release notes

  27. kiview commented on Oct 1, 2018

    @kiview
    Member

    Fixed with #845.
    We recommend trying out Testcontainers 1.9.1. If this problem persists, I'll gladly reopen the issue.

  28. jonkjenn commented on May 3, 2019

    @jonkjenn

    Seems to me the support for identitytoken was not introduced until docker-java 3.1.0-rc5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions