I want to run a docker-compose.yml on a remote docker daemon, what about volumes?

瘦欲@ 提交于 2020-07-16 03:37:26

问题


I want to run docker-compose up on a remote docker daemon:

DOCKER_HOST=tcp://...:2375 docker-compose up

In docker-compose.yml, I have a volume binding to a local file:

version: "3"
services:
  nginx:
    image: nginx:latest
    ports:
      - 80:80
    volumes:
      - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro

This won't work, as the remote docker daemon will be unable to locate ./etc/nginx/nginx.conf.

What is the best approach to handle this?


回答1:


Extend the existing docker image by creating your own docker image. Ref : How to extend existing docker container?

Copy the relevant files (from docker build-context) to appropriate directory and then it will be available in docker image and hence will also be available in remote docker demon as well.



来源:https://stackoverflow.com/questions/49789988/i-want-to-run-a-docker-compose-yml-on-a-remote-docker-daemon-what-about-volumes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!