Docker安装量用于编辑源代码 [英] Docker mounting volume for editing source code
问题描述
C:\Application\source
位置。 我希望这个信息可以在docker容器内使用,这样在开发过程中不用重建图像就可以很容易地进行代码更改。
这就是我尝试
docker run -d -P -i -t -p 8083:8080 --name html-app -v / c / application / source:/ usr / src html-app-img:vnode
图像 html-app
基于Node JS
现在,当我做一个 docker exec -it html- app / bin / bash
,它不会显示 C:\Application\source
的内容。
我以为应该可以使用吗?
在Oracle虚拟框中,我共享了文件夹 C:\Application
是还有其他什么我需要做的,以使这个工作?
在Oracle虚拟框我共享了C:\Application
这个文件夹不够。您需要修改boot2docker镜像以使TinyCore Linux会话挂载共享路径(仅限于 C:\Users\< yourlogin>
默认安装为 / c / Users /< yourLogin>
)
请参见 Docker Compose Mount Window Folder
编辑/创建$ c> root )
/mnt/sda1/var/lib/boot2docker/bootlocal.sh
,(sda1可能与您不同)
添加:
mkdir -p < local_dir>
mount -t vboxsf -o defaults,uid =`id -u docker`,gid =`id -g docker`< mount_name> < local_dir>
I have docker setup on my Windows system. The source code of the application is available at C:\Application\source
location.
I want this information to be available within the docker container so that it is easy to make code changes during development without rebuilding the image.
This is what I tried
docker run -d -P -i -t -p 8083:8080 --name html-app -v /c/Application/source:/usr/src html-app-img:vnode
The image html-app
is based on Node JS
Now when I do a docker exec -it html-app /bin/bash
, it doesn't show the contents of C:\Application\source
there.
I thought that should be available right?
In the Oracle Virtual box, I've shared the folder C:\Application
Is there anything else that I need to do to get this working?
In the Oracle Virtual box, I've shared the folder C:\Application
That is not enough. You need to modify your boot2docker image in order for the TinyCore Linux session to mount the shared path (only C:\Users\<yourlogin>
is mounted by default as /c/Users/<yourLogin>
)
See "Docker Compose Mount Window Folder"
Edit/create (as
root
)/mnt/sda1/var/lib/boot2docker/bootlocal.sh
, (sda1 may be different for you)Add:
mkdir -p <local_dir>
mount -t vboxsf -o defaults,uid=`id -u docker`,gid=`id -g docker` <mount_name> <local_dir>
(the mount might need umask
option as well)
这篇关于Docker安装量用于编辑源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!