Skip to content
Open
Changes from all commits
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: 18 additions & 4 deletions packages/docker/src/dockerCommands/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ export async function createContainer(
...(args.systemMountVolumes || [])
]
for (const mountVolume of mountVolumes) {
dockerArgs.push(
`-v=${mountVolume.sourceVolumePath}:${mountVolume.targetVolumePath}`
)
let sourceVolumePath = mountVolume.sourceVolumePath
if (
sourceVolumePath === '/var/run/docker.sock' &&
env.DOCKER_HOST &&
env.DOCKER_HOST.startsWith('unix://')
) {
sourceVolumePath = env.DOCKER_HOST.replace('unix://', '')
}
dockerArgs.push(`-v=${sourceVolumePath}:${mountVolume.targetVolumePath}`)
}
if (args.entryPoint) {
dockerArgs.push(`--entrypoint`)
Expand Down Expand Up @@ -413,9 +419,17 @@ export async function containerRun(
...(args.systemMountVolumes || [])
]
for (const mountVolume of mountVolumes) {
let sourceVolumePath = mountVolume.sourceVolumePath
if (
sourceVolumePath === '/var/run/docker.sock' &&
env.DOCKER_HOST &&
env.DOCKER_HOST.startsWith('unix://')
) {
sourceVolumePath = env.DOCKER_HOST.replace('unix://', '')
}
dockerArgs.push(`-v`)
dockerArgs.push(
`${mountVolume.sourceVolumePath}:${mountVolume.targetVolumePath}${
`${sourceVolumePath}:${mountVolume.targetVolumePath}${
mountVolume.readOnly ? ':ro' : ''
}`
)
Expand Down