假设我的主机上有一个Docker容器和一个文件夹/hostFolder.现在,如果我要对这个文件夹添加到多克尔容器的体积,那么我可以通过使用这样做ADD在Dockerfile或安装它作为一个音量.
到现在为止还挺好.
现在/hostFolder包含一个子文件夹/hostFolder/subFolder.
我想挂载/hostFolder到泊坞容器(无论是读写或只读并不重要,无论是对我的作品),但我不希望把它列入/hostFolder/subFolder.我想排除这个,我也希望Docker容器能够对这个子文件夹进行更改,而不会在主机上更改它.
这可能吗?如果是这样,怎么样?
我的节点Dockfile:
# Set the base image to ubuntu
FROM ubuntu
# Define working directory
ADD . /src
WORKDIR /src
# Install Node.js & other dependencies
RUN apt-get update && \
apt-get -y install curl && \
apt-get -y install sudo && \
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash - && \
apt-get -y install python build-essential nodejs
RUN npm install -g node-gyp && \
node-gyp clean && \
npm cache clean
RUN node -v
# Install nodemon
RUN …Run Code Online (Sandbox Code Playgroud)