Unable to start docker mongo image on windows

前端 未结 4 1229
攒了一身酷
攒了一身酷 2020-12-18 18:21

When starting the image I get the following error:

 2019-02-27T17:09:41.095+0000 E STORAGE  [initandlisten] WiredTiger error (17) [1551287381:95206][1:0x7fae         


        
4条回答
  •  死守一世寂寞
    2020-12-18 18:50

    Although Augustas is right, but I found this answer particularly useful with docker-compose.yml.

    What you can do as a workaround is:

    1. Create a .env file in the same path as your docker-compose file and store the current path in an environment variable like this:
    MONGO_HOST_DATA=/Users/user123/MyMongoProject //path to mongo data folder (for C:\Users\user123\MyMongoProject)
    
    1. Now, in your docker-compose file, replace the above-mentioned variable:
        services:
          my-mongo-db:
          build: ./database
          ports:
           - 32815:27017
          volumes:
        - ${MONGO_HOST_DATA}/database/db:/data/db
    
    • If you want to see how the actual path replaced the environment variable, you can use the following command:
    docker-compose config
    

    Additionally, if you use any disk drive other than C:\ you might want to change the Docker file sharing settings:

    Hope this helps.

提交回复
热议问题