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

NPE when no image tag is specified #676

Closed
aruizca opened this issue May 1, 2018 · 4 comments
Closed

NPE when no image tag is specified #676

aruizca opened this issue May 1, 2018 · 4 comments

Comments

@aruizca
Copy link

aruizca commented May 1, 2018

This is my current GenericContainer declaration:

    @Shared
    GenericContainer container = new GenericContainer("my-local-image")
            .withEnv("CONFLUENCE_VERSION", "6.8.2")
            .withExposedPorts(1990)
            .waitingFor(Wait.forListeningPort())

and I get the following error:

java.lang.NullPointerException
	at org.testcontainers.utility.DockerImageName.toString(DockerImageName.java:97)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at org.testcontainers.images.RemoteDockerImage.toString(RemoteDockerImage.java:25)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:841)
	at org.testcontainers.containers.GenericContainer.setDockerImageName(GenericContainer.java:829)
	at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:185)
	at com.comalatech.confluence.test.poc.PocSpec.$spock_initializeSharedFields(PocSpec.groovy:25)

FYI, the image exists locally and I am able to use it to launch containers using Docker for Mac

@kiview
Copy link
Member

kiview commented May 2, 2018

Hey @aruizca, please try to add a tag to the image name, new GenericContainer("my-local-image:latest").

@aruizca
Copy link
Author

aruizca commented May 2, 2018

Thanks @kiview,
adding the latest tag fix the NPE and now I am into the next error :-)
I reckon this should be considered as a small bug since the latest tag should be applied by default.

@helmbold
Copy link

It would be nice to either

  • default to the tag latest
  • issue a descriptive error message pointing to the missing tag.

@kiview
Copy link
Member

kiview commented Jun 12, 2018

@helmbold I also think, using latest as default tag is something Docker users are expecting.

@kiview kiview changed the title Unable to use local image with GenericContainer NPE when no image tag is specified Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants