Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Dabbling in Docker-Compose

DZone's Guide to

Dabbling in Docker-Compose

Thinking of adding separate containers to your MongoDB? Here's a quick how-to of how to get them up and running.

· Database Zone ·
Free Resource

Find out how Database DevOps helps your team deliver value quicker while keeping your data safe and your organization compliant. Align DevOps for your applications with DevOps for your SQL Server databases to discover the advantages of true Database DevOps, brought to you in partnership with Redgate

I'm starting to dabble with docker-compose to link up some container goodness. If you've followed my other Docker-related posts the past couple of days (here), then you might have noticed that I have something Raspberry-Pi-related cooking. 

Although I'll have to redo these with Pi-compatible base images, to get MongoDB running in one container with a separate data volume container is actually pretty simple. Here's what I ended up with. To start it up, 'docker-compose up -d' and you're up and running (copy this to docker-compose.yml):

mongodata: 
    image: mongo:3.2
    volumes:
        - /data/db
    entrypoint: /bin/bash
mongo: 
    image: mongo:3.2
    volumes_from:
        - mongodata
    ports:
        - "27017:27017"

Align DevOps for your applications with DevOps for your SQL Server databases to increase speed of delivery and keep data safe. Discover true Database DevOps, brought to you in partnership with Redgate

Topics:
mongodb ,container

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}