if someone is seeing the error bash: mongo: command not found after "docker exec -it mymongo bash" then once in cotainer run mongosh instead of mongo because The mongo shell is removed from MongoDB 6.0. The replacement is mongosh.
thanks for the video !! I have problem while running docker for crAPI container crapi-community error when I run docker logs crapi-community I receive this error Sad!! .env file not found 2023/06/08 02:54:22 connection() : auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed. can you help me to fix this please ?
Very nice tutorial, thanks. But I got into one problem on 4:40. While executing the "mongo localhost:2717" command, I got an error - ["mongo" is not recognized as an internal or external command, operable program or batch file] I checked if the container was running "docker ps", if the detached mod started, tried different ports, tried different terminals - always the same result
Can you please help me I am running two services mongo and redis in a docker container but for some reason i want to run it locally but after i run on docker even after i stopped the services i still am unable to run mongo locally anymore
Good one but when I enter into container by this command: docker exec -it mymongo bash and then enter mongo command it says me: bash: mongo: command not found. Any thoughts on this issue? Thanks!
i have a backend project, do i need to run this in my project folder (path). Or is this just database storage, that can summoned whenever the path my project located ? Please 🙏🙏 this is my firstime using docker with mongo, and i have a technical test to be done
hello bhai i tried this many times but when i go docker exec -it mymongo bash then type mongo show me bash: mongo: command not found please find solution on it
Nice Tutorial. But I got as far as 4:40 . when i executed the command "mongo localhost:2717". I get the error : [thread1] Error: network error while attempting to run command 'isMaster' on host 'localhost:2717' : connect@src/mongo/shell/mongo.js:237:13 @(connect):1:6 exception: connect failed
I tried it right away, and its working, u can troubleshoot in a couple of ways: 1. do "docker info" to get the number of containers running 2. do "docker container ps" , and see if mongo container is running. 3. make sure u have started the container in detached mode 4. make sure ur not using port 2717 on local machine for anything else. 5. try a different port 2718 on local machine(or any other port which is not used by system or other services) 6. try a different terminal 7. try it on a diff pc.
@@mafiacodes Well thanks to your tutorials, I was able to get a mongo docker running. I've decided to go back to native mongo, as docker was intermittently hogging my cpu. Even though I set the docker cpu settings to 1.
@@mafiacodes I am getting same error. Can you please guide how to fix this? C:\Users\PDI\Desktop\GEODIS>mongo localhost:2717 MongoDB shell version v4.4.3 connecting to: mongodb://localhost:2717/test?compressors=disabled&gssapiServiceName=mongodb Error: couldn't connect to server localhost:2717, connection attempt failed: SocketException: Error connecting to localhost:2717 (127.0.0.1:2717) :: caused by :: No connection could be made because the target machine actively refused it. : connect@src/mongo/shell/mongo.js:374:17 @(connect):2:6 exception: connect failed exiting with code 1
I am getting mongo:command not found. When I am running it by directly going to directory and running mongo localhost:2717 command instead of using docker shell. What can be done in this case?
I only don't know how to run a mongoimport command inside of container. It need to exit from mongosh to do this, but how. For example mongoimport tv-shows.json -d movieData -c movies --jsonArray --drop
@@mafiacodes any video on how to do this? I have containerized my flask application which is using mongo db. I'll create another container for mongo db. but then how to access mongo db in app present in other container
Use a docker compose file for this Here is an example which uses docker compose file for creating a wordpress application. Wordpress setup using Docker compose th-cam.com/video/Vxf3qtk1qIA/w-d-xo.html
I'm having a common issue and I am wondering if it has to do with the Mongo image. the run command you provide works, but if I stop the container and restart, it does not restart. More specifically, it will start and immediately stop. From what I've read it has to do with the fact that there is no running process in the container, and so it stops right away. I'm not sure if I need to create a custom image with Mongo installed on Linux, or if there is some other configuration step that I need to know. Any thoughts?
afaik this should not happen, u can start and stop a container as many times u want and it should be in the same state as it was on the first start (leaving apart the data)...
Nice, but I can't see my mongo related files which should created for volume in command. I did this command: docker run -d -p 2717:27017 -v ~/php_mongodb_projects:/data/db --name mymongo mongo:latest As I am in win10 OS, should I write full path of that director? Thanks.
@@mafiacodes as I'm in win10 OS, I've created a volume by below command: docker volume create --name=mongodata Then I do the below command: docker run -d -p 2717:27017 -v mongodata --name mymongo mongo:latest So it runs my container normally. After that I also checked docker exec -it bash to enter into its bash and create a database and insert a record. But the issue is after exit and exit I did the below command: mongo localhost:2717 And I get this error: 'mongo' is not recognized as an internal or external command, operable program or batch file. Any hints? Thanks.
You'll need to install MongoDB if you wish to access the MongoCLI from your terminal because The CLI utility `mongo` comes along with the mongo installation.
Well Dockerfiles are used to build your own images and here we are using the mongodb image itself and not changing it, but I guess you wanna know how to use mongodb inside docker-compose, is that so?
One of the greatest tutorials I've ever seen. Thank you!
if someone is seeing the error bash: mongo: command not found after "docker exec -it mymongo bash" then once in cotainer run mongosh instead of mongo because The mongo shell is removed from MongoDB 6.0. The replacement is mongosh.
thanks
thanks a lot for this.
The problem is there's no tutorial as such for the latest mongos even on official Mongo Documentation.
thank you so much 🙏
thanks
¡Gracias!
Para quem é br, e não conseguiu executar o comando mongo em 3:25, utilize o comando mongosh... 😉
Well done. Exactly what I was looking for.
Subscribe like share 😊
thanks for the video !! I have problem while running docker for crAPI
container crapi-community error
when I run docker logs crapi-community
I receive this error
Sad!! .env file not found
2023/06/08 02:54:22 connection() : auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.
can you help me to fix this please ?
After pulling the mongodb image.
When i enter mongo in bash it says "mongo command line not found"
need to have mongoldb installed locally to run mongo commands, else ssh into your container and run mongo there.
Execute 'docker exec -it name_mongo_container mongosh'
Simple yet informative instructions on how to quickly set up a MongoDB docker container... Well done
Thanks subscribe like share 😊
run mongosh instead of mongo if you got an error
when I go inside an conatiner and run mongo command warning is displayed as bash mongo:command not found
After run the docker mongo image how can i logged in by using robo 3t ? How can i generate username and password ?
Awesome tutorial!
Thank you! :)
You might like this also: th-cam.com/video/gChzfhVGqp8/w-d-xo.html
Very nice tutorial, thanks. But I got into one problem on 4:40. While executing the "mongo localhost:2717" command, I got an error -
["mongo" is not recognized as an internal or external command, operable program or batch file]
I checked if the container was running "docker ps", if the detached mod started, tried different ports, tried different terminals - always the same result
U need to install mongodb locally to execute the mongo command which will connect to ur docker instance
@@mafiacodes thanks
inside the container if i type mongo not able to get details as shown in the video above video
Thanks for your video.
Learning docker recently and find the solution of some mistakes.
You might like this as well:
How to dockerize NodeJS and MongoDB application using docker-compose
th-cam.com/video/vm3YfOHf_Cc/w-d-xo.html
how to get connection string for reacjs project ?
Can you please help me
I am running two services mongo and redis in a docker container but for some reason i want to run it locally but after i run on docker even after i stopped the services i still am unable to run mongo locally anymore
I really loved it. Simple and on the point.
Thanks a LOT!!!
for windows i used
PS D:\Docker\mongodb> docker volume create --name=mongodata
PS D:\Docker\mongodb> docker volume inspect mongodata
[
{
"CreatedAt": "2023-06-19T14:52:32Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/mongodata/_data",
"Name": "mongodata",
"Options": {},
"Scope": "local"
}
]
PS D:\Docker\mongodb> docker run -d -p 2717:27017 -v ${PWD}/data:/var/lib/docker/volumes/mongodata/_data --name mymongo mongo:latest
Good one but when I enter into container by this command: docker exec -it mymongo bash and then enter mongo command it says me: bash: mongo: command not found.
Any thoughts on this issue?
Thanks!
i have a backend project, do i need to run this in my project folder (path). Or is this just database storage, that can summoned whenever the path my project located ?
Please 🙏🙏 this is my firstime using docker with mongo, and i have a technical test to be done
hello bhai i tried this many times but when i go docker exec -it mymongo bash then type mongo show me bash: mongo: command not found please find solution on it
i have same problem, did you fix that?
bro in a new Mongo container on docker generally use mongosh command try it work@@vovaaa4351
bro in new docker mongo container mongosh command use @@vovaaa4351
thanks for great video.. and just to add now in 2022 dec, @3:25 the command mongo seems to be deco'ed and mongosh works instead.
Subscribe like share 👍
man, you are great!
Greetings and big thx from Ukrainian developer
It's quick and easy, but technically not really secure. Wish someone would show how to create a really secure MongoDB container.
can vice versa is possible for port mapping from docker container to host machine? Is it possible by pass parameter?
Great video! Only at minute 3:23 I had "Mongo not found". Now in mongo version 6 it's "mongoDB" instead of "mongo" (-:
now its mongosh to execute mongo shell
Thanks and pinned.
"mongosh" worked.
Can you help me? When I execute mongo localhost_2717 it tells me command not found... I'm inside ~/MongodbData but this folder is empty...
Do I need to install mongo on my machine? If I am running mongo outside of container?
Yes
Bro which keyboard you have can you give the link to buy
Great video, because it's concise!
Subscribe like share
Nice Tutorial. But I got as far as 4:40 . when i executed the command "mongo localhost:2717". I get the error :
[thread1] Error: network error while attempting to run command 'isMaster' on host 'localhost:2717' :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
I tried it right away, and its working, u can troubleshoot in a couple of ways:
1. do "docker info" to get the number of containers running
2. do "docker container ps" , and see if mongo container is running.
3. make sure u have started the container in detached mode
4. make sure ur not using port 2717 on local machine for anything else.
5. try a different port 2718 on local machine(or any other port which is not used by system or other services)
6. try a different terminal
7. try it on a diff pc.
@@mafiacodes ty for debug options. The problem was resolved by updating my mongo shell.
@@mafiacodes Well thanks to your tutorials, I was able to get a mongo docker running. I've decided to go back to native mongo, as docker was intermittently hogging my cpu. Even though I set the docker cpu settings to 1.
@@mafiacodes I am getting same error. Can you please guide how to fix this? C:\Users\PDI\Desktop\GEODIS>mongo localhost:2717
MongoDB shell version v4.4.3
connecting to: mongodb://localhost:2717/test?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server localhost:2717, connection attempt failed: SocketException: Error connecting to localhost:2717 (127.0.0.1:2717) :: caused by :: No connection could be made because the target machine actively refused it. :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
See my reply above and see if that makes a fix
I am getting mongo:command not found. When I am running it by directly going to directory and running mongo localhost:2717 command instead of using docker shell. What can be done in this case?
have u installed mongodb locally on your system
@@mafiacodes no
Install and then the command will be recognised
When i run it on synology dsm 7 it crashes
AVX in VM is a problem.. if can't use latest image i won't use it at all.. quickest dump of learning something as dev ever..
I only don't know how to run a mongoimport command inside of container. It need to exit from mongosh to do this, but how.
For example mongoimport tv-shows.json -d movieData -c movies --jsonArray --drop
can we have IDE for mongodb to manage query and other stuff ?
Use mongodb compass
is it necessary to install mongodb locally for this? because my exec command is not working
i have same problem
Very useful and quick, thanks :)
can we access this mongodb from application in other container?
Yes Nivedita you can, and in fact docker containers are meant to be used as separate entities coz every thing is sandboxed into its own environment.
@@mafiacodes any video on how to do this? I have containerized my flask application which is using mongo db. I'll create another container for mongo db. but then how to access mongo db in app present in other container
Use a docker compose file for this
Here is an example which uses docker compose file for creating a wordpress application.
Wordpress setup using Docker compose
th-cam.com/video/Vxf3qtk1qIA/w-d-xo.html
thanks a lot, really helpful !!
I'm having a common issue and I am wondering if it has to do with the Mongo image. the run command you provide works, but if I stop the container and restart, it does not restart. More specifically, it will start and immediately stop. From what I've read it has to do with the fact that there is no running process in the container, and so it stops right away. I'm not sure if I need to create a custom image with Mongo installed on Linux, or if there is some other configuration step that I need to know. Any thoughts?
afaik this should not happen, u can start and stop a container as many times u want and it should be in the same state as it was on the first start (leaving apart the data)...
Life saver !
Nice, but I can't see my mongo related files which should created for volume in command.
I did this command: docker run -d -p 2717:27017 -v ~/php_mongodb_projects:/data/db --name mymongo mongo:latest
As I am in win10 OS, should I write full path of that director?
Thanks.
yes indeed, you need to provide a full path, I dunno even if windows understand "~" means home dir
@@mafiacodes as I'm in win10 OS, I've created a volume by below command:
docker volume create --name=mongodata
Then I do the below command:
docker run -d -p 2717:27017 -v mongodata --name mymongo mongo:latest
So it runs my container normally.
After that I also checked docker exec -it bash to enter into its bash and create a database and insert a record.
But the issue is after exit and exit I did the below command:
mongo localhost:2717
And I get this error:
'mongo' is not recognized as an internal or external command,
operable program or batch file.
Any hints?
Thanks.
thank you but i need to know how to restore the backup folder to the host, can you please help me? i think it will help the rest of your subs aswell
what is the default root user id and pwd? in case i want to expose the db to cloud server.
Mongo db doesn’t have a user password unless u create one in admin db and provide them with roles.
Do I need to have Mongo installed in my actual machine also?
No not at all.
You'll need to install MongoDB if you wish to access the MongoCLI from your terminal because The CLI utility `mongo` comes along with the mongo installation.
Cheers fam! Helped a brother out
Subscribe like share
I don't know English perfectly, but i understand all.
Thanks 👍
you just saved my life!
thanks Mittal
Hi! How do you configure username:password for mongodb container?
The same way as we do it normally using the mongo shell
Thank you, Sir.
Inside Docker container Says 'bash: mongo: command not found'
How can I connect my local mysql with phpmyadmin?
$ docker pull mysql:8.0.1
$ docker run --name my-own-mysql -e MYSQL_ROOT_PASSWORD=mypass123 -d mysql:8.0.1
$ docker pull phpmyadmin/phpmyadmin:latest
$ docker run --name my-own-phpmyadmin -d --link my-own-mysql:db -p 8081:80 phpmyadmin/phpmyadmin
Visit : localhost:8081/
And ur done 😘
@@mafiacodes really appreciated your quick response , also I got it running without pulling MySQL , as my local had MySQL already.
Great
You justified your channel name👍
Thank you for the tutorial :)
Would be possible to do the same tutorial using dockerfile
Cheers
Well Dockerfiles are used to build your own images and here we are using the mongodb image itself and not changing it, but I guess you wanna know how to use mongodb inside docker-compose, is that so?
@@mafiacodes Yes, correct :)
Thanks a lot :)
the path that starts with ~ is a relative path from your home directory. an absolute path is from /
Thank!
Thanx a lot!!!!!!
Thanks
very helpful
Thank you :)
😊 subscribe like share
TY MEN
me sirve
me gusteishion
me sirveishon
lesgoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
wtf
wapo
Видео отличное, но говорит ужс
Спасибо, но я просто хотел, чтобы было легко понять
Подписаться как поделиться
NOW IS MONGO SH └─[$] docker exec -it mongodb mongosh
Thanks!