mediacms-io / mediacms

MediaCMS is a modern, fully featured open source video and media CMS, written in Python/Django and React, featuring a REST API.
https://mediacms.io
GNU Affero General Public License v3.0
2.71k stars 500 forks source link

Can't start using docker-compose: 'Are you trying to mount a directory onto a file (or vice-versa)?' #393

Closed steeeeev0 closed 2 years ago

steeeeev0 commented 2 years ago

Describe the issue I cannot start mediacms using docker-compose and docker-compose-named-volumes examples. The error states: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/home/steve/deploy/docker/local_settings.py" to rootfs at "/home/mediacms.io/mediacms/deploy/docker/local_settings.py" caused: mount through procfd: 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

To Reproduce Steps to reproduce the issue:

  1. Create docker-compose.yml file using either example on github
  2. Start using docker-compose --file mediacms-docker-compose.yml --verbose up
  3. See error

Environment (please complete the following information):

Additional context Terminal output:


[+] Running 6/6
 ⠿ Container steve-redis-1          Created                                                                        0.0s
 ⠿ Container steve-db-1             Created                                                                        0.0s
 ⠿ Container steve-celery_beat-1    Created                                                                        0.0s
 ⠿ Container steve-migrations-1     Created                                                                        0.0s
 ⠿ Container steve-celery_worker-1  Created                                                                        0.1s
 ⠿ Container steve-web-1            Created                                                                        0.1s
Attaching to steve-celery_beat-1, steve-celery_worker-1, steve-db-1, steve-migrations-1, steve-redis-1, steve-web-1
steve-redis-1          | 1:C 15 Jan 2022 20:14:41.390 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
steve-redis-1          | 1:C 15 Jan 2022 20:14:41.390 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=1, just started
steve-redis-1          | 1:C 15 Jan 2022 20:14:41.390 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
steve-redis-1          | 1:M 15 Jan 2022 20:14:41.391 * monotonic clock: POSIX clock_gettime
steve-redis-1          | 1:M 15 Jan 2022 20:14:41.392 * Running mode=standalone, port=6379.
steve-redis-1          | 1:M 15 Jan 2022 20:14:41.392 # Server initialized
steve-redis-1          | 1:M 15 Jan 2022 20:14:41.392 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
steve-redis-1          | 1:M 15 Jan 2022 20:14:41.392 * Ready to accept connections
steve-db-1             | 
steve-db-1             | PostgreSQL Database directory appears to contain a database; Skipping initialization
steve-db-1             | 
steve-db-1             | 2022-01-15 20:14:41.446 UTC [1] LOG:  starting PostgreSQL 13.5 (Debian 13.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
steve-db-1             | 2022-01-15 20:14:41.447 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
steve-db-1             | 2022-01-15 20:14:41.447 UTC [1] LOG:  listening on IPv6 address "::", port 5432
steve-db-1             | 2022-01-15 20:14:41.448 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
steve-db-1             | 2022-01-15 20:14:41.451 UTC [28] LOG:  database system was shut down at 2022-01-15 20:07:32 UTC
steve-db-1             | 2022-01-15 20:14:41.456 UTC [1] LOG:  database system is ready to accept connections
Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/home/steve/deploy/docker/local_settings.py" to rootfs at "/home/mediacms.io/mediacms/deploy/docker/local_settings.py" caused: mount through procfd: 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```
steeeeev0 commented 2 years ago

The local_settings.py file that's referenced in the error does appear on disk:

$ ls /home/steve/deploy/docker local_settings.py

steeeeev0 commented 2 years ago

Also, if anyone has this running from docker-compose examples, I’d be interested in knowing version numbers for docker and docker-compose to see if downgrading helps.

pe-cloud commented 2 years ago

Hallo stevesanda,

workaround that solved my problem:

First comment the lines in compose file that include those line where local_settings.py is mapped:

#- ./deploy/docker/local_settings.py:/home/mediacms.io/mediacms/deploy/docker/local_settings.py

Run compose file.

Open a container that includes the local_settings.py:

docker exec -ti CONTAINER_NAME bash

Go to directory with the local_settings.py and use command

cat local_settings.py

Copy the code inside and exit the container:

exit

Make directory structure /deploy/docker and new file inside:

nano local_settings.py

Paste the code and edit it for your configuration. Save it and exit the editor.

Uncomment all comments you made before in the compose file at

- ./deploy/docker/local_settings.py:/home/mediacms.io/mediacms/deploy/docker/local_settings.py

Save and exit.

Now run docker compose again. Your containers should be recreated and use the settings you have on the local host under ./deploy/docker/local_settings.py

That solved the problem for me!

HTH

steeeeev0 commented 2 years ago

This got me up and running. Thanks for your help!