あなたのテスト方法に問題があると思いますが、私はあなたの質問をよく理解していません。私は公式のイメージをテストした:私はあなたの2行Dockerfileを作成し、
docker run -d --name mongo mongo:3.3 mongod
docker exec -it mongo bash -c 'ls -la /data/db'
total 192
drwxr-xr-x 4 mongodb mongodb 4096 Oct 28 18:11 .
drwxr-xr-x 4 root root 4096 Oct 21 20:47 ..
-rw-r--r-- 1 mongodb mongodb 46 Oct 28 17:56 WiredTiger
-rw-r--r-- 1 mongodb mongodb 21 Oct 28 17:56 WiredTiger.lock
-rw-r--r-- 1 mongodb mongodb 935 Oct 28 18:11 WiredTiger.turtle
-rw-r--r-- 1 mongodb mongodb 40960 Oct 28 18:11 WiredTiger.wt
-rw-r--r-- 1 mongodb mongodb 4096 Oct 28 17:56 WiredTigerLAS.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 _mdb_catalog.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 collection-0--3585910680230311914.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 collection-2--3585910680230311914.wt
drwxr-xr-x 2 mongodb mongodb 4096 Oct 28 18:11 diagnostic.data
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 index-1--3585910680230311914.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 index-3--3585910680230311914.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 index-4--3585910680230311914.wt
drwxr-xr-x 2 mongodb mongodb 4096 Oct 28 17:56 journal
-rw-r--r-- 1 mongodb mongodb 2 Oct 28 17:56 mongod.lock
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 17:57 sizeStorer.wt
-rw-r--r-- 1 mongodb mongodb 95 Oct 28 17:56 storage.bson
は次に:
docker build -t my-mongo .
docker run -d --name my-mongo my-mongo mongod
docker exec -it my-mongo bash -c 'ls -la /data/db'
total 192
drwxr-xr-x 4 mongodb mongodb 4096 Oct 28 18:12 .
drwxr-xr-x 4 root root 4096 Oct 21 20:47 ..
-rw-r--r-- 1 mongodb mongodb 46 Oct 28 18:06 WiredTiger
-rw-r--r-- 1 mongodb mongodb 21 Oct 28 18:06 WiredTiger.lock
-rw-r--r-- 1 mongodb mongodb 932 Oct 28 18:12 WiredTiger.turtle
-rw-r--r-- 1 mongodb mongodb 40960 Oct 28 18:12 WiredTiger.wt
-rw-r--r-- 1 mongodb mongodb 4096 Oct 28 18:06 WiredTigerLAS.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 _mdb_catalog.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 collection-0-683121925029568227.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 collection-2-683121925029568227.wt
drwxr-xr-x 2 mongodb mongodb 4096 Oct 28 18:13 diagnostic.data
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 index-1-683121925029568227.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 index-3-683121925029568227.wt
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 index-4-683121925029568227.wt
drwxr-xr-x 2 mongodb mongodb 4096 Oct 28 18:06 journal
-rw-r--r-- 1 mongodb mongodb 2 Oct 28 18:06 mongod.lock
-rw-r--r-- 1 mongodb mongodb 16384 Oct 28 18:07 sizeStorer.wt
-rw-r--r-- 1 mongodb mongodb 95 Oct 28 18:06 storage.bson
は注意してください、/ data/dbディレクトリは、ボリュームとして宣言されています。あなたがそのwithn問題がある場合は、ご利用可能なディスク容量
あなたは '/データ/ db'right所有者と権限を与えてください
df -h
よろしくドッカデーモンを再起動して確認してください? – gzc
-ti argsでイメージを実行しましたが、/ dataフォルダも表示されませんでした。しかし、それは以前のイメージによって少なくとも作成されると予想されていました。 –