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

example from readme results in panic with older docker versions #300

Closed
kaxap opened this issue Mar 23, 2021 · 4 comments
Closed

example from readme results in panic with older docker versions #300

kaxap opened this issue Mar 23, 2021 · 4 comments

Comments

@kaxap
Copy link

kaxap commented Mar 23, 2021

from README.md:

	nginxC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
		ContainerRequest: req,
		Started:          true,
	})
	if err != nil {
		t.Error(err)
	}
	defer nginxC.Terminate(ctx)
	ip, err := nginxC.Host(ctx)

if the call to GenericContainer() fails, then the error reported but test execution is continued until ip, err := nginxC.Host(ctx) where it results in panic due to nil pointer dereference.
I think there should be t.Fatalf("cannot create container: %s, check your docker version", err) instead of t.Error(err)
to reduce possible confusion.

@gianarb
Copy link
Member

gianarb commented Mar 23, 2021

Hey! Thank you for your report. Can you define old? And can you paste the panic? Thanks

@kaxap
Copy link
Author

kaxap commented Apr 4, 2021

I have upgraded my Docker right away. It is related to this particular issue with Docker Desktop for Mac, as far as I remember.

@mdelapenya
Copy link
Member

mdelapenya commented Oct 2, 2021

There is ongoing work to refactor the docs: #351

I think we could close this one if that one is merged

@mdelapenya
Copy link
Member

Let's close this issue, as it seems fixed by the Docker for Mac upgrade. Apart from that, in #353 the examples were updated

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

No branches or pull requests

3 participants