0

As said in documentation, if I want to run testcontainers inside a docker I have to consider the following points:

  1. The docker socket must be available via a volume mount
  2. 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.

How to comply with 2nd point, mainly with the -v $PWD:$PWD condition if I use Docker for Windows?

mohan08p
  • 5,002
  • 1
  • 28
  • 36
MarkHuntDev
  • 181
  • 3
  • 21

1 Answers1

0

On windows, instead socket, docker uses named pipes.

docker run -v \\.\pipe\docker_engine:\\.\pipe\docker_engine

But you need Windows v1709 and special version of Docker for Windows, since this feature is experimental.

More info: https://blog.docker.com/2017/09/docker-windows-server-1709/

As for the $PWD, on windows cmd you can use %CD% variable which does this same job. Powershell also has a $pwd, same as in linux. But unfortunatelly, they does not work with docker-compose, as they're not true environment variables.

I think easiest would be to execute a short script to create .env file on windows where PWD= will be set to the current dir:

 echo PWD=%cd% > .env

and you can use $PWD in docker-compose same as on linux.

Miq
  • 3,931
  • 2
  • 18
  • 32