简体   繁体   English

如何访问在Windows OS的Docker工具箱Linux容器中创建的项目目录?

[英]How can I access the project directories that are created in the Docker toolbox Linux containers on my Windows OS?

I have just installed Docker ToolBox on Windows 10 OS and created a Linux Python container. 我刚刚在Windows 10 OS上安装了Docker ToolBox,并创建了一个Linux Python容器。 I have cloned a project from GitHub in that container. 我已经从GitHub的容器中克隆了一个项目。 How can I access the project directories that are created in the Linux containers on my Windows OS? 如何访问在Windows OS的Linux容器中创建的项目目录? Are they saved in any drive or directory? 它们保存在任何驱动器或目录中吗?

I have obtained the docker image container using the command 我已经使用以下命令获得了Docker图像容器

docker pull floydhub/dl-docker:cpu

and running it using the command 并使用命令运行它

docker run -it -p 8888:8888 -p 6006:6006 -v /sharedfolder:/root/sharedfolder floydhub/dl-docker:cpu bash

Also I am running my project using docker quick start terminal, is there any other way (GUI based) to manage and run my projects? 另外我正在使用docker quick start terminal运行项目,是否有其他方法(基于GUI)来管理和运行我的项目?

More details about how your Linux Python container was launched, IE the build file/ run command, would be helpful. 有关如何启动Linux Python容器的更多详细信息(即build file / run命令)将很有帮助。 But that being said, you can copy files out of a container using docker cp as described here: https://docs.docker.com/engine/reference/commandline/cp/ 话虽如此,您可以按照以下说明使用docker cp从容器中复制文件: https : //docs.docker.com/engine/reference/commandline/cp/

Also, if you use volumes you can view the cloned repo right on your Windows machine directly, but those volumes must be setup during the build process and cannot be added to a running container. 另外,如果使用卷,则可以直接在Windows计算机上直接查看克隆的存储库,但是这些卷必须在构建过程中设置,并且不能添加到正在运行的容器中。 More details on volumes and how data persistence works in docker: https://docs.docker.com/engine/admin/volumes/volumes/ 有关卷以及Docker中数据持久性如何工作的更多详细信息: https : //docs.docker.com/engine/admin/volumes/volumes/

To answer your question about a GUI docker tool, I've used Kitematic ( https://kitematic.com/ ) but personally found the CLI faster and easier to use. 为了回答有关GUI docker工具的问题,我使用了Kitematic( https://kitematic.com/ ),但我个人发现CLI更快,更易于使用。

Edit According to edits you do in fact have volumes that will persist data to your local Windows machine. 编辑实际上,根据编辑,您确实具有将数据持久保存到本地Windows机器的卷。 But I believe you need to use a separate -v flag for each: (docker documentation is unclear about this as they now suggest using --mount, but according to this SO post: Mounting multiple volumes on a docker container? suggests the multiple flags): 但是我相信您需要为每个使用单独的-v标志:(docker文档对此尚不明确,因为他们现在建议使用--mount,但根据此SO帖子: 在docker容器上装载多个卷?建议使用多个标志):

docker -v /sharedfolder:/root/sharedfolder \
       -v floydhub/dl-docker:cpu

A side note: it is sometimes confusing to not use absolute paths when mounting volumes as you've done in floydhub/dl-docker:cpu. 附带说明:像在floydhub / dl-docker:cpu中所做的那样,在装入卷时不使用绝对路径有时会造成混淆。 Its not always clear where this data might live. 目前尚不清楚这些数据可能存放在哪里。

Any data that is stored in the docker container at /root/sharedfolder should be available in Windows at /sharedfolder Windows中/ sharedfolder的docker容器中/ root / sharedfolder中存储的所有数据都应可用

Edit 2 To match your original docker run command: 编辑2要匹配您原来的docker run命令:

docker run -it -p 8888:8888 -p 6006:6006 -v /sharedfolder:/root/sharedfolder -v floydhub/dl-docker:cpu bash

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python:如何在Linux的特定目录中查找上一个小时创建的新文件夹/目录 - Python: How can i find new folders/directories created in last hour in a specific directory in Linux 如何使用我的项目的 .pyc(pycache)文件构建 docker - How can I build docker with .pyc (pycache) files of my project 我可以使用django在Windows上使用相同的os.path访问PC上的文件夹吗? - can i use django to access folders on my pc using same os.path for windows? 如何在Linux上以。开头的python中使用文件/目录? - How can I use files/directories in python on Linux that start with .? 如何在 Windows 中设置操作系统密钥以便稍后在 Python 中访问它? - How can I SET an OS key in windows to have access to it later in Python? 如何像在 Windows 中一样在 Mac OS 上定位我的 mozilla 配置文件? - How can I target my mozilla profile on Mac OS the same way I'm targeting it in Windows? 如何使用 WSL(适用于 Linux 的 Windows 子系统)访问 Django 服务器? - How can I access the Django server using WSL (Windows Subsystem for Linux)? 为什么我无法访问 html 中的 Table 容器? - Why can I not access the Table containers in the html? 我如何知道我的 Flask WebApp 的用户使用的是 Windows 还是 Linux 机器? - How can I know if a user of my Flask WebApp use a Windows or Linux machine? Python:如果我的包在 Linux、Mac 和 Windows 上运行,我如何测试它 - Python: How can I test my package if it runs on Linux, Mac and Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM