version: '3'
services:
nginx:
image: nginxtest
container_name: nginxtest-container
volumes:
- "$PWD:/apps"
ports:
- "80:80"
以上是我的撰写文件。
我在该目录中创建了虚拟文件。如果我想忽略或排除在一个文件中所做的更改,而所有其他文件应该反映原来的更改,那么该怎么做。
假设你想挂载$ PWD但想要排除$PWD/template
,你可以使用它。
version: '3'
services:
nginx:
image: nginx
container_name: nginxtest-container
volumes:
- "/apps/template"
- "$PWD:/apps"
ports:
- "80:80"
/apps/template
创造了一个独立的空间。 $PWD/template
中的任何内容都不会在容器中反映出来,/apps/template
中的任何内容也不会反映在主机上。