Skip to content

Instantly share code, notes, and snippets.

@viktorbenei
Last active July 21, 2020 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save viktorbenei/073b920c45ad294181cc888ed5112353 to your computer and use it in GitHub Desktop.
Save viktorbenei/073b920c45ad294181cc888ed5112353 to your computer and use it in GitHub Desktop.
docker-compose.yml (v3) example

Build - every time the Dockerfile changes

docker-compose build

Run:

docker-compose run mysuperawesomeproject

Start and "log into Bash":

docker-compose run mysuperawesomeproject bash

Start and keep running in background:

docker-compose up
version: '3'
services:
mysuperawesomeproject:
build: .
command: psql -h mydb -U postgres
depends_on:
- mydb
- redis
volumes:
- .:/testdir
environment:
MY_TEST_ENV: the test value
redis:
image: redis:3.0
mydb:
image: postgres:9.4
FROM ubuntu:16.04
RUN apt-get update -qq
RUN apt-get install -y postgresql-client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment