Thanks a lot! Yes it’s been a while since the last video. I was too busy with my studies. Hopefully I can continue to upload more videos again. Thanks again for staying with the channel. ❤
I have some doubts, how the MongoDB data persisted? Is it automatic or we need to add any specific command or key in the files? Do we not loose data if we remove a container? Or does it happen when we delete the image of MongoDB?
I'm glad you came up with this confusion. When you run containers, the containers are connected to a default bridge network. In this default bridge network, containers can communicate with each other, even if the ports are not explicitly exposed to the outside world. In your scenario, the Node.js application container and the MongoDB container are on the same default bridge network created by Docker Compose. Since they are on the same network, the Node.js container can reach the MongoDB container without needing to expose the MongoDB port (27017) to the host machine or the external network. Containers connected to the same bridge network can communicate with each other over their internal IP addresses or container names. Docker Compose automatically assigns a container name as a hostname that can be used for communication within the network. If you want to access the MongoDB container from outside (Eg: See the tables with Compass or any database client) the Docker network or from the host machine, you would need to expose the MongoDB port in the docker-compose.yml file. Hope that helps!
Great work... We didn't see your tutorials from long time.... What if database is sql server or mysq.... I think we need series tutorials on docker
Thanks a lot! Yes it’s been a while since the last video. I was too busy with my studies. Hopefully I can continue to upload more videos again. Thanks again for staying with the channel. ❤
I didn't see you explicitly create a mongodb container, did docker compose handle that already
Thank you a lot, but can i somehow see database that i created as a container?
yes you can enter in container by docker exec -it sh
Can I export the data of mongodb ,as I want to see it in my local system
?
I have some doubts, how the MongoDB data persisted? Is it automatic or we need to add any specific command or key in the files? Do we not loose data if we remove a container? Or does it happen when we delete the image of MongoDB?
you did not expose 27017 port for MongoDB. how this can run without that??
I'm glad you came up with this confusion. When you run containers, the containers are connected to a default bridge network. In this default bridge network, containers can communicate with each other, even if the ports are not explicitly exposed to the outside world.
In your scenario, the Node.js application container and the MongoDB container are on the same default bridge network created by Docker Compose. Since they are on the same network, the Node.js container can reach the MongoDB container without needing to expose the MongoDB port (27017) to the host machine or the external network.
Containers connected to the same bridge network can communicate with each other over their internal IP addresses or container names. Docker Compose automatically assigns a container name as a hostname that can be used for communication within the network.
If you want to access the MongoDB container from outside (Eg: See the tables with Compass or any database client) the Docker network or from the host machine, you would need to expose the MongoDB port in the docker-compose.yml file. Hope that helps!
Im facing error in
Post method that path title description and price is required even if i have passed it through a body
Can you mention which part of the video you're facing the error ? (kindly mention the time)
same error here ..
`docker-compose up` didn't work for me, so I tried `docker-compose up --build` and that resolved the issue.
thanks
👍
Environment variables arent set correctly in the docker compose file. It should be in the format:
KEY=value
On the .env file yes.
Why volume is used? What if volumes is not used?
It's for persistent storage. When the container stops or destroyed, data shouldn't be destroyed right ? We use volumes for that.
why, we can't see data in compass? please i've spent whole for that?
Can you pls make video on dockerize nodejs with postgresql/sql? Thank you.
Yo check this out: th-cam.com/video/LSt1af5YZcQ/w-d-xo.html
Thanks a lot
Most welcome!!!
thx!!
You’re welcome!
Why everyone using docker compose instead of normal
What do you mean by normal ?
@@coderawesome manually running the docker container
I spent a lot of time for this. It's doesn't work without mongo:6.0-focal
Official mongo image worked for me though.