-
Notifications
You must be signed in to change notification settings - Fork 649
Mongo crash when I use --user #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Not sure what do you mean but to persist your database, you just need to mount data path to docker volume.
|
The image has supported running as an arbitrary user since #81. The caveat is that the operator running the container must supply a data directory that the chosen I am unable to reproduce any crash: $ ls -lna data
total 8
drwxrwsr-x 2 1000 1000 4096 Jan 24 15:53 .
drwxrwsr-x 4 1000 1000 4096 Jan 4 2023 ..
$ docker run -it --rm --user "$(id -u):$(id -g)" --mount "type=bind,src=$PWD/data/,dst=/data/db" --name mgo mongo
...
{"t":{"$date":"2023-07-20T23:11:18.031+00:00"},"s":"I", "c":"NETWORK", "id":23015, "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}
{"t":{"$date":"2023-07-20T23:11:18.031+00:00"},"s":"I", "c":"NETWORK", "id":23015, "ctx":"listener","msg":"Listening on","attr":{"address":"0.0.0.0"}}
{"t":{"$date":"2023-07-20T23:11:18.032+00:00"},"s":"I", "c":"NETWORK", "id":23016, "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
$ docker top mgo
UID PID PPID C STIME TTY TIME CMD
1000 687807 687786 14 23:09 ? 00:00:00 mongod --bind_ip_all
$ ls -lna data/
total 216
drwxrwsr-x 4 1000 1000 4096 Jul 20 16:12 .
drwxrwsr-x 4 1000 1000 4096 Jan 4 2023 ..
-rw------- 1 1000 1000 50 Jul 20 16:12 WiredTiger
-rw------- 1 1000 1000 21 Jul 20 16:12 WiredTiger.lock
-rw------- 1 1000 1000 1464 Jul 20 16:12 WiredTiger.turtle
-rw------- 1 1000 1000 49152 Jul 20 16:12 WiredTiger.wt
-rw------- 1 1000 1000 4096 Jul 20 16:12 WiredTigerHS.wt
-rw------- 1 1000 1000 20480 Jul 20 16:12 _mdb_catalog.wt
-rw------- 1 1000 1000 20480 Jul 20 16:12 collection-0-2226854324434403819.wt
-rw------- 1 1000 1000 20480 Jul 20 16:12 collection-2-2226854324434403819.wt
-rw------- 1 1000 1000 4096 Jul 20 16:12 collection-4-2226854324434403819.wt
drwx--S--- 2 1000 1000 4096 Jul 20 16:12 diagnostic.data
-rw------- 1 1000 1000 20480 Jul 20 16:12 index-1-2226854324434403819.wt
-rw------- 1 1000 1000 20480 Jul 20 16:12 index-3-2226854324434403819.wt
-rw------- 1 1000 1000 4096 Jul 20 16:12 index-5-2226854324434403819.wt
-rw------- 1 1000 1000 4096 Jul 20 16:12 index-6-2226854324434403819.wt
drwx--S--- 2 1000 1000 4096 Jul 20 16:12 journal
-rw------- 1 1000 1000 0 Jul 20 16:12 mongod.lock
-rw------- 1 1000 1000 20480 Jul 20 16:12 sizeStorer.wt
-rw------- 1 1000 1000 114 Jul 20 16:12 storage.bson Alternatively, you can just use a named volume and let Docker manage the data directory (but then, you'd have to let the image start as |
maybe should you update the image with docker's new feature.
How can I save my database if I can't persist this directory...
The text was updated successfully, but these errors were encountered: