Skip to content

Instantly share code, notes, and snippets.

@YanhaoYang
Created July 17, 2018 11:06
Show Gist options
  • Save YanhaoYang/72cf38877f073d096a96ec0e9f85cded to your computer and use it in GitHub Desktop.
Save YanhaoYang/72cf38877f073d096a96ec0e9f85cded to your computer and use it in GitHub Desktop.
Docker compose with ssh-agent
version: '2'
services:
postgres:
image: postgres:9.6
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: a
web:
image: yanhao/ruby-dev:2.5.0
hostname: web.dev
ports:
- "8000:8000"
working_dir: /home/docker/src
volumes:
- ./src/web:/home/docker/src
- ./tmp:/home/docker/.zsh_histories
- "${HOME}/.vbuf:/home/docker/.vbuf"
volumes_from:
- ssh-agent
environment:
- HISTFILE=/home/docker/.zsh_histories/.zsh_history
- PG_URL=postgres://postgres:a@postgres/veh
- SSH_AUTH_SOCK=/.ssh-agent/proxy-socket
- GIT_AUTHOR_NAME=Yanhao Yang
- GIT_AUTHOR_EMAIL=me@example.com
- GIT_COMMITTER_NAME=Yanhao Yang
- GIT_COMMITTER_EMAIL=me@example.com
ssh-agent:
image: yanhao/ssh-agent # docker run --rm --volumes-from=x_ssh-agent_1 -v ~/.ssh:/.ssh -it yanhao/ssh-agent:latest ssh-add /root/.ssh/id_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment