exit code 14 error in mongodb container, I'm using mongodb container with with volume path then received exit code 14 error

Viewed 13261
version: "3"
services:
   mongo:
      image: mongo
      working_dir: /c/data/
      ports:
       - 27017:27017
      deploy:
        replicas: 1
      volumes:
        - /c/data/:/data/db

I am tried that above stack file and I'm receiving exit code 14 error please give me the solution about the error,

6 Answers

Delete everything from /c/data/, in case there are some data from older version of Mongo

In your terminal:

docker system prune

Works for me. Kew Approves =)

*Please, be careful! it clears everything!!

It depends how you get up the service, for example use:

docker-compose up -d (on Windows)

instead of docker-compose up. In this way you have the control on terminal to call docker-compose down and the MongoDB process can terminate correctly.

On a Mac, you might be able to resolve the issue by deleting the /Users/{your account}/data folder.

You should be able to find the folder by going to Finder -> Go -> Go to Folder -> And search ~/Users/.

Other solutions that I tried before this that didn't work:

  • stopping and removing all mongo containers
  • removing all mongo images
  • Clean / Purge data from Docker Desktop
  • uninstall and reinstall Docker
  1. Install WSL2 ( It requires recent windows update)
  2. Docker -> Settings -> Enable-> Use WSL 2 based engine

For me what helped is deleting the mounted host directory, deleting the volume with docker volume rm {CONTAINER NAME\ID}. Make sure to write the volume in compose right, for example:

  ...

  database:
    container_name: database
    image: mongo
    ports:
      - '27017:27017'
    volumes:
      - db:/data/db  
  ...  
  volumes: 
    db:  

Related