Skip to content

Instantly share code, notes, and snippets.

@kalw
Created June 15, 2020 06:39
Show Gist options
  • Save kalw/a57d154b30b0ba4469a0bfcedc95914e to your computer and use it in GitHub Desktop.
Save kalw/a57d154b30b0ba4469a0bfcedc95914e to your computer and use it in GitHub Desktop.
play-with-docker docker-compose
version: '3.2'
services:
haproxy:
container_name: haproxy
image: haproxy
ports:
- "80:8080"
volumes:
- ./haproxy:/usr/local/etc/haproxy
pwd:
# pwd daemon container always needs to be named this way
container_name: pwd
# use the latest golang image
image: kalw/play-with-docker:pwd
# go to the right place and starts the app
command: /bin/sh -c 'ssh-keygen -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key >/dev/null; cd /go/src/; go run api.go -save /pwd/sessions -name l2'
volumes:
# since this app creates networks and launches containers, we need to talk to docker daemon
- /var/run/docker.sock:/var/run/docker.sock
# mount the box mounted shared folder to the container
- sessions:/pwd
l2:
container_name: l2
# use the latest golang image
image: kalw/play-with-docker:l2
# go to the right place and starts the app
command: /bin/sh -c 'ssh-keygen -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key >/dev/null; cd /go/src/router/l2; go run l2.go -ssh_key_path /etc/ssh/ssh_host_rsa_key -name l2 -save /pwd/networks'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- networks:/pwd
ports:
- "8022:22"
- "8053:53"
- "443:443"
volumes:
sessions:
networks:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment