wodby / docker4drupal

Docker-based Drupal stack
https://wodby.com/docker4drupal
MIT License
1.24k stars 535 forks source link

How to access files from outside of a built-in vanila container #188

Closed f1rf1n closed 6 years ago

f1rf1n commented 7 years ago

This is probably a very easy question to answer (I'm probably just missing something) Some background and the question first, requested info is below. I started a plain vanilla d4d to do a drupal upgrade / migrate project. Started building my Contenttypes, views etc, added quite a few modules (using composer). But now I realise I need to create a custom module to hold the migrations yaml files. Unfortunately I can not figure out how to access my 'codebase' (as defined in the docker-compose.yaml file) from phpstorm (version 17.2, or any editor). I believe this is because codebase is a named volume and not a bindmount (I think are the correct docker terms.) Using a bindmount now would make the current files inaccessible. Also I would to stay in the 'right' way of working with D4D.

So, how do I access and edit the 'codebase' ?

Codebase: Built-in vanilla Drupal

Host OS: Ubuntu 16.04

Docker info output

Containers: 50 Running: 7 Paused: 0 Stopped: 43 Images: 36 Server Version: 17.03.1-ce Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 344 Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe init version: 949e6fa Security Options: apparmor seccomp Profile: default Kernel Version: 4.10.0-35-generic Operating System: Ubuntu 16.04.2 LTS OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 7.678 GiB Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ WARNING: No swap limit support Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false

Docker compose file: edited, left out all uncommented lines

version: "2"

services: mariadb: image: wodby/mariadb:10.1-2.3.3 environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: drupal MYSQL_USER: drupal MYSQL_PASSWORD: drupal

php: [STABILITY_TAG]. image: wodby/drupal:8-7.1-2.4.4 environment: PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025 DB_HOST: mariadb DB_USER: drupal DB_PASSWORD: drupal DB_NAME: drupal DB_DRIVER: mysql volumes:

volumes: codebase:

Logs output

Will post any logs needed, but don't know which is relevant at this point.

f1rf1n commented 7 years ago

For now I solved my immediate problem by using docker cp to copy the fiels out, changing my docker-compose.yml to use mounts instead of named volumes, and then copying the files back.

Still wondering what workflow /setup would be best for using named volumes in development.

pprishchepa commented 7 years ago

Just replace codebase:/var/www/html by ./path-to-your-codebase:/var/www/html. Your dir with codebase ./path-to-your-codebase will be mounted into a container.

f1rf1n commented 7 years ago

Yeah and current contents op/var/www/html will be 'overwritten' by what was in ./path-to-your-codebase . This is the difference between a named volume and a bindmount, I found out this weekend. Was wondering why the vanilla install uses a named volume.

pprishchepa commented 7 years ago

Named volume allows to share Drupal codebase between nginx and php services.

ghost commented 2 years ago

~So what is the answer?~

Install Drupal separately