Docker Compose 101

Introduction

  • myservice_1 — its some JVM application that uses 2g of memory and needs to communicate with redis (using tcp) and myservice_2 (using http).
  • we want to share a storage volume across all three of the containers.
services:
agent:
image: "myservice_1"
command: ["--cache", "cache:6379", "--backend_http", "http://backend_service:4000" ]
environment:
JAVA_OPTS: -Xmx2g
volumes:
- /tmp/disk:/data
ports:
- 49100:22
cache:
image: "redis"
volumes:
- /tmp/disk:/data
expose:
- "6379"
backend_service:
image: "myservice_2"
command: ["--http_port", "4000" ]
volumes:
- /tmp/disk:/data
expose:
- "4000"

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store