Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose doesn't persist data using volumes #2971

Closed
iskyd opened this issue Feb 19, 2016 · 1 comment
Closed

docker-compose doesn't persist data using volumes #2971

iskyd opened this issue Feb 19, 2016 · 1 comment

Comments

@iskyd
Copy link

iskyd commented Feb 19, 2016

Hi, I have set up two containers db and web app and now i'm trying to run it using docker-compose.
This is my docker-compose.yml

db:
    image: mysql:latest
    ports:
    - "3309:3306"
    volumes:
        - /home/mattia/docker/data/mysql
magento:
    image: eone/magento
    ports:
        - "8001:80"
    links:
        - db
    command:
        bash -c "/sbin/virtualhost.sh create magento.docker /var/www/magento && /sbin/magento-setup.sh && apache2ctl -DFOREGROUND"
    volumes:
        - /home/mattia/docker/data/magento

I omitted all env vars for better reading.
The containers starts and works right, but i have a problem with data-persist.
I created a two folders /home/mattia/docker/data/magento /home/mattia/docker/data/mysql and give them 777 permission.
Now i try to create some db or apply some modify to web app but neither containers persist data on volumes.
If i for example inspect mysql container i get :

"Volumes": {
            "/home/mattia/docker/data/mysql": {},
            "/var/lib/mysql": {}
        },

If i run the containers using docker run and specify -v /home/mattia/docker/data/path the containers seems to persist data correctly.
So where i'm wrong?
Thanks in advance.

@iskyd
Copy link
Author

iskyd commented Feb 19, 2016

Okay i think that the problem is that i have to specify also the path on the container.
So for example :

volumes:
        - /home/mattia/docker/data/mysql:/var/lib/mysql

@iskyd iskyd closed this as completed Feb 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant