-
Notifications
You must be signed in to change notification settings - Fork 650
Closed
Description
Use case: As a sys admin, I need to run a MongoDB Docker container with a custom "approved" service account. This is company IT policy.
Today, the mongodb Docker container starts up the docker-entrypoint.sh
as root and spins up mongod
running as mongodb user, which is created at image build time.
Trying to use a custom --user user:group
fails as the file system permissions are not good.
$ docker run --rm --name mongo --user 202:202 mongo:3.6.9-stretch
2018-11-19T08:27:39.395+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=f267c856d149
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] db version v3.6.9
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] git version: 167861a164723168adfaaa866f310cb94010428f
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.0f 25 May 2017
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] allocator: tcmalloc
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] modules: none
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] build environment:
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] distmod: debian92
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] distarch: x86_64
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] target_arch: x86_64
2018-11-19T08:27:39.396+0000 I CONTROL [initandlisten] options: { net: { bindIpAll: true } }
2018-11-19T08:27:39.397+0000 I STORAGE [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating
2018-11-19T08:27:39.397+0000 I CONTROL [initandlisten] now exiting
2018-11-19T08:27:39.397+0000 I CONTROL [initandlisten] shutting down with code:100
Can you provide instructions or a Dockefile with support for such a requirement?
Metadata
Metadata
Assignees
Labels
No labels