简体   繁体   中英

Get access to folder at host machine from docker container

I have a docker container with Jenkins installed on it. I installed the Wix toolset plugin to create CI/CD pipeline for MSI packages

I need to provide a path to a folder at host machine

I tried it like this, but docker don't see the path

在此处输入图像描述

I tried to execute this command

docker jenkins-master  run -v C:\Program Files (x86)\WiX Toolset v3.11\bin

But have same stuff. Where can be a problem?

UPDATE

I tried to do it like this

docker run -d --name jenkins-master -v "/c/Program Files (x86)/WiX Toolset v3.11/bin":/downloads jenkins-master

And get this error

Unable to find image 'jenkins-master:latest' locally docker: Error response from daemon: pull access denied for jenkins-master, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. See 'docker run --help'.

Here is a list of my containers

在此处输入图像描述

While it is possible to add a volume to a running container on Linux (see this article ), I don't know of any way to do it on Windows, especially since Linux containers do nor run directly on the host Windows machine, but rather in a virtual machine running Linux. This virtual machine typically has acces only to C:\Users (mounted as /c/Users ) and not to C:\Program Files (x86) .

Your bes bet would be to edit the VM to give it access to C:\Program Files (x86)\WiX Toolset v3.11 (exact method depends on whether you use Docker Toolbox or Docker for Windows), destroy your Jenkins container and recreate with with the directory properly mounted.

That being said I do not believe that a Linux installation of Jenkins will be able to use a Windows Wix binary. The best solution would be to turn your Windows host into a Jenkins slave that runs the whole build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM