Giter Club home page Giter Club logo

Comments (5)

twhtanghk avatar twhtanghk commented on July 17, 2024 2

My solution is to define environment variable "COMPOSEDIR" on compuse ui docker-compose.yml as follows:

version: '2'
services:
  composeui:
    image: francescou/docker-compose-ui
    container_name: composeui
    environment:
      - GIT_REPO=https://github.com/francescou/docker-compose-ui.git
      - COMPOSEROOT=/home/user/git/docker.shell
    ports:
      - 5000:5000
    volumes:
      - ..:/opt/docker-compose-projects
      - /var/run/docker.sock:/var/run/docker.sock

The volume relative to the directory defined in "COMPOSEROOT" can then be referenced in the docker-compose.yml of other service (e.g. ovs) as follows:

version: '2'
services:
  ovs:
    image: socketplane/openvswitch
    container_name: ovs
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    volumes:
      - /lib/modules:/lib/modules
      - ${COMPOSEROOT}/ovs:/root
    network_mode: host

I also tried to replace the variable name "COMPOSEROOT" with "PWD". It seems fine. For your info.

from docker-compose-ui.

francescou avatar francescou commented on July 17, 2024

Hi,
I managed to reproduce the issue. The problem occurs when you mount a volume by its relative path, if you write the full path of the folder it works, e.g. /opt/docker-compose-projects/my-awesome-project/scripts/.

However, I will make further investigation to fix the application to support relative paths.

from docker-compose-ui.

tarunlalwani avatar tarunlalwani commented on July 17, 2024

For now I moved the server out of docker to fix the issue as I have delivery of a project dependent on this. There are some caveats that needs to be worked out.

if we map a folder like ../scripts then it would point to your /opt/scripts, now if I map the folder while running docker-compose-ui, then on first time the mapping won't work. But if I restart the container using docker client it works. So some different type of use cases needed to checked out around this area

from docker-compose-ui.

francescou avatar francescou commented on July 17, 2024

I've made several tests, I came to the conclusion that the problem is caused by Compose itself while running inside a container.

I've tried to mount a volume with docker-compose inside a container based on the official centos image and then another one based on dduportal/docker-compose. In both cases I didn't manage to mount a volume.

I've also found some information about the problem on the following links: dduportal/docker-compose/#volumes-relative-and-absolute (check also the workaround suggested by kayvan in the comments) and https://github.com/dduportal/dockerfiles/issues/5

I will close the issue, feel free to reopen if necessary.

from docker-compose-ui.

francescou avatar francescou commented on July 17, 2024

Hi Tommy, it seems a good solution

thanks for your contribution

from docker-compose-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.