Mounting a sub directory of my solution into the docker container #767
-
Hi, We use sqitch for managing schema deployments into our postgres database. I want to have a testfixture that first runs postgres in test containers then spin up another testcontainer that contains an installation of sqitch and pass it our sqitch files so that we can deploy our schema for testing. I've got my postgres instance running but right now I am struggling to make any head way with running my sqitch files in testcontainers. So far I have the following: _sqitchContainer = new ContainerBuilder()
.WithName(Guid.NewGuid().ToString("D"))
.WithImage("docker.otenv.com/location-docker-sqitch")
.WithVolumeMount("//c/github.com/location-scheduled-tasks/location-read-schema", "/mnt/location-read-schema")
.WithWorkingDirectory("/mnt/location-read-schema")
.WithWaitStrategy(Wait.ForUnixContainer().UntilCommandIsCompleted("deploy"))
.Build(); I get the following.
if i change to _sqitchContainer = new ContainerBuilder()
.WithName(Guid.NewGuid().ToString("D"))
.WithImage("docker.otenv.com/location-docker-sqitch")
.WithVolumeMount("//c/github.com/location-scheduled-tasks/location-read-schema", "location-read-schema")
.WithWorkingDirectory("location-read-schema")
.WithWaitStrategy(Wait.ForUnixContainer().UntilCommandIsCompleted("deploy"))
.Build(); And I get the following
The docker command
Works. I'm confused by the API for testcontainers vs how it seems to be working in Docker command line. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Beta Was this translation helpful? Give feedback.
WithVolumeMount(string, string)
is intended for Docker managed volumes. You are lookin forWithBindMount(string, string)
. Please note, that we do not recommend to mount local paths into the container. It makes testing very hard across different development machines or CI environments.