Using a dedicated Docker network¶
Use this method to avoid having to expose PostreSQL port to the host’s network or if you have other PostgreSQL instances but still want to use the default port of 5432 for this installation.
Create the network:
docker network create mayan
Launch the PostgreSQL container with the network option and remove the port binding (
-p 5432:5432
):docker run \ -d \ --name mayan-edms-postgres \ --network=mayan \ --restart=always \ -e POSTGRES_USER=mayan \ -e POSTGRES_DB=mayan \ -e POSTGRES_PASSWORD=mayanuserpass \ -v /docker-volumes/mayan-edms/postgres:/var/lib/postgresql/data \ postgres:13.10-alpine
Launch the Redis container with the network option and remove the port binding (
-p 6379:6379
):docker run \ -d \ --name mayan-edms-redis \ --network=mayan \ -v /docker-volumes/mayan-edms/redis:/data \ redis:7.0.10-alpine \ redis-server \ --databases \ "3" \ --maxmemory-policy \ allkeys-lru \ --save \ "" \ --requirepass mayanredispassword
Launch the Mayan EDMS container with the network option and change the database hostname to the PostgreSQL container name (
mayan-edms-postgres
) instead of the IP address of the Docker host (172.17.0.1
):docker run \ -d \ --name mayan-edms \ --network=mayan \ --restart=always \ -p 80:8000 \ -e MAYAN_CELERY_BROKER_URL="redis://:mayanredispassword@mayan-edms-redis:6379/0" \ -e MAYAN_CELERY_RESULT_BACKEND="redis://:mayanredispassword@mayan-edms-redis:6379/1" \ -e MAYAN_DATABASES="{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'mayan','PASSWORD':'mayanuserpass','USER':'mayan','HOST':'mayan-edms-postgres'}}" \ -e MAYAN_LOCK_MANAGER_BACKEND="mayan.apps.lock_manager.backends.redis_lock.RedisLock" \ -e MAYAN_LOCK_MANAGER_BACKEND_ARGUMENTS="{'redis_url':'redis://:mayanredispassword@mayan-edms-redis:6379/2'}" \ -v /docker-volumes/mayan-edms/media:/var/lib/mayan \ mayanedms/mayanedms:s4