diff --git a/docs/en_US/container_deployment.rst b/docs/en_US/container_deployment.rst
index aaf3b0671..c8d04772a 100644
--- a/docs/en_US/container_deployment.rst
+++ b/docs/en_US/container_deployment.rst
@@ -52,6 +52,14 @@ to login to pgAdmin. This variable is required and must be set at launch time.
 This is the password used when setting up the initial administrator account to
 login to pgAdmin. This variable is required and must be set at launch time.
 
+**PGADMIN_DEFAULT_PASSWORD_FILE**
+
+This is the password used when setting up the initial administrator account to
+login to pgAdmin. This value should be set to *docker secret* in order to set
+the password. This variable is supported in docker swarm environment or while creating
+container with docker compose. PGADMIN_DEFAULT_PASSWORD or PGADMIN_DEFAULT_PASSWORD_FILE
+variable is required and must be set at launch time.
+
 **PGADMIN_DISABLE_POSTFIX**
 
 *Default: <null>*
diff --git a/pkg/docker/entrypoint.sh b/pkg/docker/entrypoint.sh
index 0e1bb3efc..a3ce771ad 100755
--- a/pkg/docker/entrypoint.sh
+++ b/pkg/docker/entrypoint.sh
@@ -36,8 +36,8 @@ EOF
 fi
 
 if [ ! -f /var/lib/pgadmin/pgadmin4.db ]; then
-    if [ -z "${PGADMIN_DEFAULT_EMAIL}" -o -z "${PGADMIN_DEFAULT_PASSWORD}" ]; then
-        echo 'You need to define the PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD environment variables.'
+    if ([ -z "${PGADMIN_DEFAULT_EMAIL}" ]) || ( [ -z "${PGADMIN_DEFAULT_PASSWORD}" ] && [ ! -n "${PGADMIN_DEFAULT_PASSWORD_FILE}" ] ); then
+        echo 'You need to define the PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD or PGADMIN_DEFAULT_PASSWORD_FILE environment variables.'
         exit 1
     fi
 
@@ -47,6 +47,11 @@ if [ ! -f /var/lib/pgadmin/pgadmin4.db ]; then
         exit 1
     fi
 
+    # Read secret contents
+    if [ -n "${PGADMIN_DEFAULT_PASSWORD_FILE}" ]; then
+        export PGADMIN_DEFAULT_PASSWORD=$(cat ${PGADMIN_DEFAULT_PASSWORD_FILE})
+    fi
+
     # Set the default username and password in a
     # backwards compatible way
     export PGADMIN_SETUP_EMAIL=${PGADMIN_DEFAULT_EMAIL}
