[Solved] Docker Desktop Start MongoDb Error: Error: spawn C:\Windows\system32\cmd.exe; ENOENT

Complete error reporting information

Complete error reporting information:
cannot start docker-compose application. Reason: error invoking remote method ‘compose action’: error: spawn C:\windows\system32\cmd.exe enoent

Solving process

When installing MongoDB, the installation method is to run the command in the CMD window to pull the MongoDB image for installation, and habitually delete the configuration file after installation. Therefore, it is thought that this configuration file may be missing. Therefore, MongoDB is deleted from the docker desktop, and a path is selected for reinstallation.

Solution (for reference only)

Create a folder under any path (here is my path)

D:\Program Files\docker-mongodb

And put the docker-compose.yml configuration file in the folder (the following is the content of the configuration file)

version: '3.7'
services:
  mongodb_container:
    image: mongo:latest
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: rootpassword
    ports:
      - 27017:27017
    volumes:
      - mongodb_data_container:/data/db

volumes:
  mongodb_data_container:

Open CMD as an administrator and enter the path to the docker-compose.yml configuration file, that is, execute the command docker-compose up – d
in the folder just created. Open the docker desktop again and you can use mongodb normally
enter Mongo admin – U root – P password for testing

be careful

The mongodb version number and root password here can be modified in the configuration file of. YML

Read More: