docker4drupal
docker4drupal copied to clipboard
Dockerize existing Drupal 8 Multisite
Codebase mounted codebase D8.8.6
Describe your issue Hello,
I try to put my LAMP D8 multisite install (with virtualhosts) into a dockerized stack via D4D. My tree folder looklke this: projetcfolder:
- docker4drupal folder contain docker-compose and env files
- racine folder: contains drupal core and other files and folders like sites, themes...
- .git folder
- .gitignore file
Change for PHP7.3 cause this error error: Warning: require(/var/www/html/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/autoload.php on line 17
Output of docker info
Paste hereServer:
Containers: 9
Running: 8
Paused: 0
Stopped: 1
Images: 8
Server Version: 19.03.8
Storage Driver: overlay2
Contents of your docker-compose.yml
apache:
image: wodby/apache:$APACHE_TAG
container_name: "${PROJECT_NAME}_apache"
depends_on:
- php
environment:
APACHE_LOG_LEVEL: debug
APACHE_BACKEND_HOST: php
APACHE_VHOST_PRESET: php
APACHE_DOCUMENT_ROOT: /var/www/html
volumes:
- ../racine:/var/www/html:cached
# # Alternative for macOS users: docker-sync https://wodby.com/docs/stacks/drupal/local#docker-for-mac
# - docker-sync:/var/www/html
labels:
- "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`${PROJECT_BASE_URL}`)"
php:
image: wodby/drupal-php:$PHP_TAG
container_name: "${PROJECT_NAME}_php"
environment:
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
volumes:
- ../racine:/var/www/html:cached
Contents of your .env
PROJECT_NAME=drupal8-multiste
PROJECT_BASE_URL=drupal.docker.localhost
MARIADB_TAG=10.4-3.8.5
Thanks for tips and help
After adding the vendor folder and set the APACHE_DOCUMENT_ROOT: /var/www/html/racine and keep volume mount as default , the error 404 disappear. Next step, connect to the imported db. Actually get php_network_getaddresses: getaddrinfo failed: Name does not resolve error.
Next step to go, create vhost working. Actually I add this to the apache container:
labels:
# - "traefik.enable: true" #Expose les domaines à l'extérieur
- "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`${PROJECT_BASE_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`ce.${PROJECT_BASE_URL}`)"
but only the second work. The first stop working after adding the second. So, how can I add vhosts to reach each of my mutisites (8 for all)
Update: vhost works with something like this and traefik 2.0:
- "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`${PROJECT_BASE_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_apache_ce.rule=Host(`ce.${PROJECT_BASE_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_apache_ca.rule=Host(`ca.${PROJECT_BASE_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_apache_cg.rule=Host(`cg.${PROJECT_BASE_URL}`)"
- into docker-compose:
- ./param_custom/apache_custom/httpd.conf:/usr/local/apache2/conf/httpd.conf
But I can't modify php.ini settings with an external file like this in docker-compose:
- ./param_custom/php_custom/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
- ./param_custom/php_custom/php-7.3.ini:/usr/local/etc/php/conf.d/php.ini
Files are loaded but not applied according phpinfo():
Additional .ini files parsed: /usr/local/etc/php/conf.d/php.ini, /usr/local/etc/php/conf.d/uploads.ini,
memory_limit 512M instead of 1G
If someone can help me.
In addition container (php) can't access internet behind a proxy, settings provided to docker desktop but no effects. There, help needed too.
Thanks