本文介绍了我想在远程docker守护程序上运行docker-compose.yml,那么卷呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在远程docker守护程序上运行 docker-compose up

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

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

docker-compose.yml ,我有一个绑定到本地文件的卷:

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

这将不起作用,因为远程docker守护程序将无法找到 ./ etc / nginx / nginx.conf

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?

推荐答案

通过创建自己的docker扩展现有docker映像图片。
参考:

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

将相关文件(从docker build-context复制)到适当的目录,然后它将在docker映像中可用,因此也将在远程docker demon中可用。

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.

这篇关于我想在远程docker守护程序上运行docker-compose.yml,那么卷呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 19:18