Topics

On this page

Mounting an External Drive Inside PHP Container

Follow the below steps to mount an external drive inside PHP container to use the Uploads folder.

Steps

/data/example.com/uploads/
ee shell example.com
/var/www/htdocs/current/wp-content/uploads
/opt/easyengine/sites/example.com

a. Below the htdocs line for php service

php:
    image: easyengine/php7.3:v4.0.0
    restart: always
    labels:
    - "io.easyengine.site=${VIRTUAL_HOST}"
    volumes:
    - "htdocs:/var/www"
    - "/data/example.com/uploads/:/var/www/htdocs/current/wp-content/uploads"

b. Below the htdocs line for nginx service

nginx:
    image: easyengine/nginx:v4.0.3
    depends_on:
    - php
    restart: always
    labels:
    - "io.easyengine.site=${VIRTUAL_HOST}"
    volumes:
    - "htdocs:/var/www"
    - "/data/example.com/uploads/:/var/www/htdocs/current/wp-content/uploads"
ee site disable example.com && ee site enable example.com

Verification

Upload a file and check if you can see the file at the host path. In our example scenario – /data/example.com/uploads/