简体   繁体   中英

How to access a file of Mac from Docker container

I am running robot framework (Selenium based) testing inside a Docker container. But I need to access files outside the Docker container (in Mac).

I have tried providing absolute path of the Mac but Docker refers it's core folder as the root folder.

I found below links for Windows, but not for Mac.

Docker - accessing files inside container from host

Access file of windows machine from docker container

one approach is copy your files inside docker container at creation time, but if your files updates by another service on host, and it needs to access them too, just mount it like below.

docker run -d --name your-container -v /path/to/files/:/path/inside/container containername:version

this way files on the host machine mounts into docker container and the user inside container can access them.

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