Skip to content

Commit

Permalink
Tweak docs re in-docker usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rnorth committed Jan 21, 2017
1 parent 23b0f51 commit 7f36420
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions docs/usage/dind.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Docker in Docker

Since TestContainers version 1.1.8, you can run your tests inside a container.
It's very useful for different CI scenarios like running everything in containers on Jenkins.
> Since 1.1.8
Testcontainers itself can be used from inside a container.
This is very useful for different CI scenarios like running everything in containers on Jenkins, or Docker-based CI tools such as Drone.

TestContainers will automatically detect if it's inside a container and instead of "localhost" will use the default gateway's IP.

However, an additional configuration is required if you use [volume mapping](options.md#volume-mapping).
However, additional configuration is required if you use [volume mapping](options.md#volume-mapping). The following points need to be considered:

* The docker socket must be available via a volume mount
* The 'local' source code directory must be volume mounted *at the same path* inside the container that Testcontainers runs in, so that Testcontainers is able to set up the correct volume mounts for the containers it spawns.

## Docker-only
## Docker-only example
If you run the tests with just `docker run ...` then make sure you add `-v $PWD:$PWD -w $PWD -v /var/run/docker.sock:/var/run/docker.sock` to the command, so it will look like this:
```bash
$ tree .
Expand All @@ -26,7 +31,7 @@ Where:
* `-w $PWD` will set the current directory to this volume
* `-v /var/run/docker.sock:/var/run/docker.sock` will map the Docker socket

## Docker Compose
## Docker Compose example
The same can be achived with Docker Compose:
```yaml
tests:
Expand Down

0 comments on commit 7f36420

Please sign in to comment.