Skip to content

Commit 13e19a8

Browse files
committed
Chown files in /opt/couchdb only when necessary
Recursive modification of ownership and permissions in the entrypoint has been implicated in slow container startup times. This change checks the ownership first and only modifies it if necessary. It is modeled after similar changes recently applied to a number of other projects e.g. redis/docker-library-redis#166.
1 parent 87dc8d2 commit 13e19a8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

2.2.0/docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ if [ "$1" = 'couchdb' ]; then
2525
fi
2626

2727
if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
28-
# we need to set the permissions here because docker mounts volumes as root
29-
chown -fR couchdb:couchdb /opt/couchdb || true
28+
# Check that we own everything in /opt/couchdb and fix if necessary
29+
find /opt/couchdb \! \( -user couchdb -group couchdb \) -exec chown couchdb:couchdb '{}' +
3030

3131
chmod -fR 0770 /opt/couchdb/data || true
3232

dev/docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ if [ "$1" = 'couchdb' ]; then
2525
fi
2626

2727
if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
28-
# we need to set the permissions here because docker mounts volumes as root
29-
chown -fR couchdb:couchdb /opt/couchdb || true
28+
# Check that we own everything in /opt/couchdb and fix if necessary
29+
find /opt/couchdb \! \( -user couchdb -group couchdb \) -exec chown couchdb:couchdb '{}' +
3030

3131
chmod -fR 0770 /opt/couchdb/data || true
3232

0 commit comments

Comments
 (0)