0

Using this image with docker-compose.yml: https://hub.docker.com/_/wordpress Everything done by the book and it works till I tried to symlinks some folders to my git repository.

This is the part of my docker-compose.yml

 wordpress:
    image: wordpress
    restart: always
    ports:
      - 80:80
    environment:
      WORDPRESS_DB_HOST: wordpressdb
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: cms_local
    volumes:
      - ./wordpress:/var/www/html

Some plugins and themes from folder wp-content/plugins and wp-content/themes I removed and created symlink instead to my git repository. Unfortunatelly Apache couldn't access them and throw the following error:

AH00037: Symbolic link not allowed or link target not accessible: /var/www/html/wp-content/themes/cms-child-theme, referer: http://localhost/

When I tried to cd from the docker into these folder I get the following error:

lrwxr-xr-x  1 www-data www-data   80 Sep 19 12:25 cms-child-theme -> /Users/anatoly/Developer/example.com/wordpress/themes/cms-child-theme
-rw-rw-r--  1 root     root       28 Jun  5  2014 index.php
drwxr-xr-x 28 root     root      896 Jun 29  2021 twentyfifteen
drwxr-xr-x 42 root     root     1344 Jun 29  2021 twentyfourteen
drwxr-xr-x 34 root     root     1088 Jun 29  2021 twentynineteen
drwxr-xr-x 25 root     root      800 Jun 29  2021 twentysixteen
drwxr-xr-x 23 root     root      736 Jun 29  2021 twentytwenty
drwxr-xr-x 28 root     root      896 Jun 29  2021 twentytwentyone
drwxr-xr-x 12 root     root      384 Feb 28  2022 twentytwentytwo
root@47205851c7e7:/var/www/html/wp-content/themes# cd cms-child-theme
bash: cd: cms-child-theme: No such file or directory

Can it be solved?

Anatoly
  • 140
  • 1
  • 9

1 Answers1

1

The symlink is resolved inside the container. You can add the directory as an additional volume

volumes:
 - ./wordpress:/var/www/html
 - /Users/anatoly/Developer/example.com/:/Users/anatoly/Developer/example.com/
Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79