testcontainers / testcontainers-hs

Docker containers for your integration tests! http://hackage.haskell.org/package/testcontainers
MIT License
58 stars 13 forks source link

Make the reaper container respect `DOCKER_HOST` #47

Closed Sereja313 closed 7 months ago

Sereja313 commented 10 months ago

Problem: The reaper container currently expects a docker socket to be available at /var/run/docker.sock, but this is not always the case. Especially with rootless docker, which usually puts the socket at $XDG_RUNTIME_DIR/docker.sock and then exports it as DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock. In this case, the reaper container will not be able use docker.

Solution: Check if the DOCKER_HOST environment variable sets the docker socket location to something other than the default.

Sereja313 commented 10 months ago

I also noticed that despite the fact that the config has a configCreateReaper field that allows you to set your own reaper container, at the moment the user cannot define their own reaper container since the library does not provide a method for modifyingnoReaper field of ContainerRequest. Perhaps skipReaper or something like setNoReaper should be exported by the library.

alexbiehl commented 7 months ago

@Sereja313 I provided your suggestion in https://github.com/testcontainers/testcontainers-hs/pull/48.

Sereja313 commented 7 months ago

Great! Thank you!