Persistent data for a web site

Hi all,

I wish to persist data from the site present in /var/www/html in a directory on my physical host (eg /var/my_app/data/web).

Here is my dockerfile :

mantis-db:
ports:

  • 3306
    image: mysql:latest
    volumes:
  • /var/my_app/data/mysql:/var/lib/mysql
    mantis-web:
    ports:
  • 80
    image: vimagick/mantisbt:latest
    links:
  • mantis-db
    volumes:
  • /var/my_app/data/web:/var/www/html

MySQL server data has been persisted but not from the web server:
.

├── mysql
│ ├── auto.cnf
│ ├── bugtracker
│ │ └── db.opt
│ ├── ib_buffer_pool
│ ├── ibdata1
│ ├── ib_logfile0|
│ ├── …
├── web

If I inspect, they have the same configuration

“Mounts”: [
{
“Source”: “/var/my_app/data/mysql”,
“Destination”: “/var/lib/mysql”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “rprivate”
}
],

“Mounts”: [
{
“Source”: “/var/my_app/data/web”,
“Destination”: “/var/www/html”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “rprivate”
}
],

The only thing that differs is the directory rights:

drwxr-xr-x 6 999 docker 4096 sept. 14 09:36 mysql
drwxr-xr-x 2 root root 4096 sept. 14 09:36 web

By cons , if I do not specify a path physical host side , he created me one volume with data from website:

[…]
volumes:

  • /var/www/html
    […]

If I inspect:

“Mounts”: [
{
“Name”: “d26d0329b577865aaeef57b4d645d8746d3ac5374be8e236e44469443aabd96d”,
“Source”: “/var/lib/docker/volumes/d26d0329b577865aaeef57b4d645d8746d3ac5374be8e236e44469443aabd96d/_data”,
“Destination”: “/var/www/html”,
“Driver”: “local”,
“Mode”: “”,
“RW”: true,
“Propagation”: “”
}
],

And I show inside:

ls /var/lib/docker/volumes/d26d0329b577865aaeef57b4d645d8746d3ac5374be8e236e44469443aabd96d/_data

account_delete.php                            bug_report_page.php                    manage_custom_field_edit_page.php          news_rss.php
account_manage_columns_page.php

And then, here are the rights that are applied to the directory :

drwxr-xr-x 14 www-data www-data 12288 sept. 14 10:07 /var/lib/docker/volumes/d26d0329b577865aaeef57b4d645d8746d3ac5374be8e236e44469443aabd96d/_data

If you have an idea, let me know! =)

Thanks