J
J
jScheq2018-05-28 06:54:38
Docker
jScheq, 2018-05-28 06:54:38

How to mount data volume in docker-compose?

Hello.
How to mount a large "data" folder from the host machine into the "web" service?
Those. directory on the host: /var/www/app/build/public/data must be available inside the container along the path /usr/src/app/build/public/
data clear(((
I have the following docker-compose:

version: '3'
services:
    web:
        image: docker-node-express-mongoapp
        build: ./
        working_dir: /usr/src/app/
        command: node index.js
        ports:
            - "3000:3000"
        volumes:
            - ./build:/usr/src/app
            - /usr/src/app/node_modules
        depends_on:
            - "mongo"
        
    mongo:
        image: "mongo"
        ports: 
            - "27017:27017"

    adminmongo:
        image: "mrvautin/adminmongo"
        ports:
            - "1234:1234"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hikmat Abdunabiev, 2018-05-28
@jScheq

It is necessary to add to the volumes of the web service:

volumes:
    - ./build:/usr/src/app
    - /var/www/app/build/public/data:/usr/src/app/build/public/data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question