I can not share adequately the volume that I generate in docker-compose

0

I have created a docker-compose file to be able to create the two containers that I need right now a custom mysql container and a wordpress container. I try to create volume and share folders so as not to lose the data and to be able to modify the php files.

The fact is that the two volumes are created. When I do a docker volume ls appear, but the container and 'my pc' are not communicated through the shared folder. Absolutely nothing is downloaded to the folder. It's as if there is no communication at all.

My pc is a windows 10 pro, and I have the docker containers in linux.

File docker-compose:

version: '3.0'

services:
   db:
     image: mysql:custom
     volumes:
       - c:\proyectos\bbdd:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: root
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: ****

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     volumes:
        - C:\proyectos\wordpress:/var/www/html
     ports:
       - "8000:80"
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: root
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_NAME: wordpress
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: ****
volumes:

I've been working with docker for a few days, I'm not an expert. Thanks for your time and help.

    
asked by PiP 10.08.2018 в 12:46
source

2 answers

0

you have to use the complete path of the host (your pc) and the container. Ex:

volumes:
       - <path_del_host>:<path_del_container>
    
answered by 11.08.2018 в 00:45
0

Take a look at this file on github:

Wordpress inside Docker sharing volumes

and this guide: link

    
answered by 29.09.2018 в 14:25