Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker 使用卷时如何排除子文件夹?_Docker_Volume_Mount - Fatal编程技术网

Docker 使用卷时如何排除子文件夹?

Docker 使用卷时如何排除子文件夹?,docker,volume,mount,Docker,Volume,Mount,上面是我的撰写文件 我已经在那个目录中创建了虚拟文件。如果我想忽略或排除在一个文件中所做的更改,而所有其他文件都应该反映更改的原貌,那么如何做到这一点 假设您想挂载$PWD,但想排除$PWD/template,您可以使用此选项 version: '3' services: nginx: image: nginxtest container_name: nginxtest-container volumes: - "$PWD:/apps" ports

上面是我的撰写文件


我已经在那个目录中创建了虚拟文件。如果我想忽略或排除在一个文件中所做的更改,而所有其他文件都应该反映更改的原貌,那么如何做到这一点

假设您想挂载$PWD,但想排除
$PWD/template
,您可以使用此选项

version: '3'
services:
  nginx:
    image: nginxtest
    container_name: nginxtest-container
    volumes:
      - "$PWD:/apps"
    ports:
      - "80:80"

/apps/template
创建一个单独的空间。
$PWD/template
中的任何内容都不会镜像到容器中,
/apps/template
中的任何内容也不会反映到主机上。

假设您要装载$PWD,但要排除
$PWD/template
,您可以使用此选项

version: '3'
services:
  nginx:
    image: nginxtest
    container_name: nginxtest-container
    volumes:
      - "$PWD:/apps"
    ports:
      - "80:80"

/apps/template
创建一个单独的空间。
$PWD/template
中的任何内容都不会镜像到容器中,
/apps/template
中的任何内容也不会反映到主机上。

感谢的可能重复内容的可能重复,当模板是文件夹时,此功能有效,文件里面的模板不会反映到容器中,但是如果我想忽略一个文件,让我们考虑模板是一个文件,那么…………谢谢,这是当模板是一个文件夹,模板里面的文件不会反映到容器中,但是如果我想忽略一个文件,让我们考虑模板是一个文件,那么该怎么办?