diff --git a/1.6.1/docker-entrypoint.sh b/1.6.1/docker-entrypoint.sh index c1c9f56..5044b95 100755 --- a/1.6.1/docker-entrypoint.sh +++ b/1.6.1/docker-entrypoint.sh @@ -14,6 +14,16 @@ set -e if [ "$1" = 'couchdb' ]; then + # map user UID and group GID's back to parent system + # useful for using persistent volumes and preserving id mappings + if [ "$COUCHDB_UID" ]; then + usermod -o -u $COUCHDB_UID couchdb + fi + + if [ "$COUCHDB_GID" ]; then + groupmod -o -g $COUCHDB_GID couchdb + fi + # we need to set the permissions here because docker mounts volumes as root chown -R couchdb:couchdb \ /usr/local/var/lib/couchdb \ diff --git a/2.0.0/docker-entrypoint.sh b/2.0.0/docker-entrypoint.sh index 2ff1715..7f44d8c 100755 --- a/2.0.0/docker-entrypoint.sh +++ b/2.0.0/docker-entrypoint.sh @@ -14,6 +14,16 @@ set -e if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then + # map user UID and group GID's back to parent system + # useful for using persistent volumes and preserving id mappings + if [ "$COUCHDB_UID" ]; then + usermod -o -u $COUCHDB_UID couchdb + fi + + if [ "$COUCHDB_GID" ]; then + groupmod -o -g $COUCHDB_GID couchdb + fi + # we need to set the permissions here because docker mounts volumes as root chown -R couchdb:couchdb /opt/couchdb