Tuesday, January 6, 2015

boot2docker connection and volume problems between containers

If you have connection problems between the linked containers, source may be somewhere else. I had a project with lots of containers where many of them were failing to connect to rabbitmq on boot2docker. It was fine on Linux. I figured out when I removed the volumes, they worked. After a while, I realized the problem was that rabbitmq was not starting with volumes that's why I couldn't connect. Only root user had access to the volumes. I was not the root. This was a bug. There does not seem to be a proper solution yet.

Problematic   : boot2docker: Docker v1.4.1 fig 1.0.1
Working Fine: Linux: Docker v1.4.0 fig 1.0.1

I've set up a sample fig file below:
test:  image: dockerfile/python  links:    - rabbitmq
rabbitmq:  image: dockerfile/rabbitmq  expose:    - "5672"    - "15672"  volumes:
    - ./volumes/rabbitmq-log:/data/log
    - ./volumes/rabbitmq-data:/data/mnesia 

When I run a ping to the linked rabbitmq (or anything else), it fails to reach the host. On Linux, it's working fine. On boot2docker, it's not working:

$ fig run test ping rabbitmq

Starting myproj_rabbitmq_1...
PING rabbitmq ( 56(84) bytes of data.
From e72f4fbf6706 ( icmp_seq=1 Destination Host Unreachable
From e72f4fbf6706 ( icmp_seq=2 Destination Host Unreachable
From e72f4fbf6706 ( icmp_seq=3 Destination Host Unreachable

When I removed volumes section, it worked.