简体   繁体   中英

docker: Error response from daemon: network mongo-network not found

I am trying to create a container in a.network but while creating I am getting this error:

docker: Error response from daemon: network mongo-network not found

Here mongo.network is the name of.network which i have created. The command I am using is:

docker run --network mongo-network -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password --name mongodb -d mongo

Error in this command or something else happens. How to slove this problem?

Raj use $docker.network ls to see the available.networks. Use the name of the.network created or present in place of mongo.network. If you wanna use the same.network name, you first need to create a.network by the name mongo.network you can use thew following command.

$docker.network create -d bridge mongo.network

If you use the default.network name it would be something like this.

$docker run -.network none -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password --name mongodb -d mongo

Or else you can execute your command and wont be having an error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM