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

docs: Add Docker Desktop Compose example #731

Merged
merged 4 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/examples/compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Compose

## Docker Desktop

To use Docker's Compose tool to build and run a Testcontainers environment in a Docker Desktop Wormhole configuration,
it is necessary to override Testcontainers Docker host resolution and set the environment variable `TESTCONTAINERS_HOST_OVERRIDE` to `host.docker.internal`.
HofmeisterAn marked this conversation as resolved.
Show resolved Hide resolved
Otherwise, Testcontainers cannot access sibling containers like the Resource Reaper Ryuk or other services running on the Docker's host.
HofmeisterAn marked this conversation as resolved.
Show resolved Hide resolved
A minimal `docker-compose.yml` file that builds a new container image and runs the test inside the container look something like:

```Yaml
version: "3"
services:
docker_compose_test:
build:
dockerfile: Dockerfile
context: .
entrypoint: dotnet test
HofmeisterAn marked this conversation as resolved.
Show resolved Hide resolved
environment:
- TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ nav:
- api/resource-reaper.md
- api/wait_strategies.md
- Examples:
- examples/compose.md
- examples/aspnet.md
- Modules:
- modules/index.md
Expand Down