Setup MongoDB on Docker:
- First I pull MongoDB image from docker hub using below command
- Run mongo container and run it in background using below command
- You can verify by using docker ps command
- Now we setup another instance which act as client and link with mongodb container to connect mongodb. The name of the container will different in my case it is nifty_driscoll you can get it in docker ps -a command output. The container run in interactive mode with bash.
- To connect mongodb you need ip address of mongodb server, you can find it using docker inspect DockerID command
- Once you login in client docker machine you can use mongo using below command
- You have successfully deployed MongoDB server and client
No comments:
Post a Comment