Docker指定应使用哪个卷

时间:2018-10-02 13:07:26

标签: docker docker-compose docker-volume

我在两个容器之间共享一个卷:

  # server
  server:
    image: nginx:alpine
    volumes:
      - nginxconf:/etc/nginx/conf.d
      - appdata:/var/www/html
    ports:
      - "8082:80"

  # app
  app:
    image: myimage
    volumes:
      - nginxconf:/etc/nginx/conf.d
      - appdata:/var/www/html

  volumes:
    appdata:
    nginxconf:

容器app的Nginx配置文件app.conf已复制到其conf.d文件夹中

# in app
# /etc/nginx/conf.d
.
..
app.conf

我希望将app.conf挂载在nginxconf的{​​{1}}文件夹中的卷server中,所以在etc/nginx/conf.d中应该是:

server

但是,# in server # /etc/nginx/conf.d . .. app.conf 中装载的是nginxconf的{​​{1}},所以server的{​​{1}}中出现的是

conf.d

是否有任何方法可以指定卷server应该用作参考哪个容器?<​​/ p>

conf.d占用# in server # /etc/nginx/conf.d . .. default.conf 的{​​{1}}而不是nginxconf的{​​{1}}。所以我期望appdata会这样做,

0 个答案:

没有答案
相关问题