M
M
Maxim Barulin2017-09-21 16:09:51
Docker
Maxim Barulin, 2017-09-21 16:09:51

How to mount different directories from the host machine into two containers from one image to one point of the container?

Good day! There is a compose config:

version: '2'

services:
  web:
  mysql-redmine:
  redmine:
    image: sameersbn/redmine:3.3.4
    depends_on:
     - mysql-redmine
    environment:
     - TZ=Europe/Moscow
    ports:
     - "10083:80"
    volumes:
     #- redmine_test:/home/redmine/data
     - type: volume
       source: redmine_test
       target: /srv/docker/redmine/redmine
       volume:
         nocopy: true
  redmine-preprod:
    image: sameersbn/redmine:3.3.4
    depends_on:
     - mysql-redmine
    environment:
     - TZ=Europe/Moscow
    ports:
     - "10084:80"
    volumes:
     #- redmine_preprod:/home/redmine/data
     - type: volume
       source: redmine_preprod
       target: /srv/docker/redmine_preprod/redmine
       volume:
         nocopy: true
volumes:
   redmine_test: 
   redmine_preprod:

but in this case errors are produced. If you simply write the mount in both redmine as
`/srv/docker/redmine/redmine:/home/redmine/redmine`, and the second `/srv/docker/redmine_preprod/redmine:/home/redmine/redmine`
then the error Service " redmine-preprod" is using volume "/home/redmine/data" from the previous container. Host mapping "/srv/docker/redmine_preprod/redmine" has no effect.
How to properly configure such a system?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question