Docker

Docker + Mongo + Windows

My laptop runs on windows 7 and so I used the following link to install docker-toolbox.

https://docs.docker.com/toolbox/toolbox_install_windows/

My laptop is enabled with virtualization. I validated this by using the tool provided by Microsoft. Link to the tool is provided in the docker installation steps.

Windows 7 depends on VirtualBox to achieve the virtualization and it will be installed along with docker components. As I have installed the virtualbox already in my machine, I skipped it.

Docker quick start terminal is like a terminal in Linux and this is the one will be used for doing all the docker commands.

A virtual machine called default is created in Virtualbox which acts as a base for creating docker containers.

Once the installation is complete, I pulled and created containers for hello-world and ubuntu images. It worked as expected.

Now I pulled and created the container for Postgresql with 5432 port mapping with the host. Port is mapped fine and I was able to access the postgres using pgAdmin.

Later I pulled a mongo image and created a container with port mapping but my surprise I was not able to access mongodb from my host using RoboMongo.

I deleted and recreated the containers but it didn’t work out. So next option is google.

I searched and found the following link which solved the problem.

http://codehangar.io/mongodb-image-instance-with-docker-toolbox-tutorial/

Port mapping has to be done with the host after creating the container. I do not know why this didn’t happen with Postgres. I will find out and update the blog.

Update:

Create mongodb container with replica set enabled,

docker run -p 27017:27017 –name fmdb2 mongod –replSet fmreplicanopreallocsmallfiles

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s