Skip to content

Instantly share code, notes, and snippets.

@wesleybliss
Created September 9, 2016 21:37
Show Gist options
  • Save wesleybliss/29d4cce863f5964a3eb73c42501d99e4 to your computer and use it in GitHub Desktop.
Save wesleybliss/29d4cce863f5964a3eb73c42501d99e4 to your computer and use it in GitHub Desktop.
Docker Compose with example App & Mongo
version: '2'
services:
myapp:
build: .
container_name: "myapp"
image: debian/latest
environment:
- NODE_ENV=development
- FOO=bar
volumes:
- .:/var/www:rw
- /tmp/.X11-unix:/tmp/.X11-unix:rw
ports:
- 3000:3000
- 9000:9000
links:
- mongodb
depends_on:
- mongodb
mongodb:
image: mongo:latest
container_name: "mongodb"
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
volumes:
- ./data/db:/data/db
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null # --quiet
@dongmai
Copy link

dongmai commented Jul 17, 2018

Thanks!!!

@yami12376
Copy link

ERROR: Cannot locate specified Dockerfile: Dockerfile

@danielecr
Copy link

Hi,
I want to prepare a MongoDB and unittests cointanters. How to configure mongo section to terminate it, when python app finish whit exit code 0?

Maybe too late, but ...

--abort-on-container-exit \
    --exit-code-from [containername]

--exit-code-from is usefull as well for testing (i.e. I use this as jenkins test step)

@SarasaGunawardhana
Copy link

helpful!

@aleksb86
Copy link

same than yami12376:
ERROR: Cannot locate specified Dockerfile: Dockerfile
WIDW?

@ralyodio
Copy link

for some reason my data directory on the host is owned by influxdb:root....anyone know why?

@LittleBuster
Copy link

Thank you!

@vaibhav-nunna
Copy link

/data/db:/data/db
data:/data/db:rw" is used in service "db" but no declaration was found in the volumes section.

May I know what might be the issue,
I'm using docker for windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment