Answer the question
In order to leave comments, you need to log in
Why is the .env folder mounted instead of the .env file when trying to host Octobercms on docker?
Goodnight. I want to raise this cms through docker, I found a turnip
. I
used this docker-compose.yml
#docker-compose.yml
version: '2.2'
services:
web:
image: aspendigital/octobercms:latest
init: true
restart: always
ports:
- 80:80
environment:
- TZ=Europe/Moscow
volumes:
- ./.env:/var/www/html/.env
- ./plugins:/var/www/html/plugins
- ./storage/app:/var/www/html/storage/app
- ./storage/logs:/var/www/html/storage/logs
- ./themes:/var/www/html/themes
mysql:
image: mysql:5.7
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=octobercms
Starting 71128a7f7e03_october_web_1 ... error
ERROR: for 71128a7f7e03_october_web_1 Cannot start service web: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \ \\"/home/devellopah/projects/october/.env\\\" to rootfs \\\"/var/lib/docker/overlay2/f03809fe2b8b7517227a731122a2b22569cad1014295a15a40e73d62c0989b3d/merged\\\" at \\\"/var/lib/ docker/overlay2/f03809fe2b8b7517227a731122a2b22569cad1014295a15a40e73d62c0989b3d/merged/var/www/html/.env\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice versa)? Check if the specified host path exists and is the expected type
ERROR: for web Cannot start service web: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/home/ devellopah / projects / october / .env \\\ "to rootfs \\\" / var / lib / docker / overlay2 / f03809fe2b8b7517227a731122a2b22569cad1014295a15a40e73d62c0989b3d / merged \\\ "at \\\" / var / lib / docker / overlay2 / f03809fe2b8b7517227a731122a2b22569cad1014295a15a40e73d62c0989b3d / merged/var/www/html/.env\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
On image build, a default .env is created...
- ./.env:/var/www/html/.env
Answer the question
In order to leave comments, you need to log in
Because .env is connected like this
version: "3.5"
services:
db:
build:
context: ./docker
dockerfile: postgresql.Dockerfile
env_file:
- .env
restart: always
volumes:
- postgres:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
redis:
env_file:
- .env
restart: always
image: redis:3.0
expose:
- "6379"
Database credentials and other sensitive information should not be committed to the repository. Those required settings should be outlined in .env.example
Passing environment variables via Docker can be problematic in production. A phpinfo() call may leak secrets by outputting environment variables. Consider mounting a .env volume or copying it to the container directly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question