docker-compose启动多个容器

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
version: '3'
services:
pypiserver:
image: pypiserver/pypiserver:latest
container_name: pypiserver
ports:
- "80:8080"
volumes:
- /data/packages/:/data/packages/

pypi_server:
image: pypiserver:v1.0
container_name: pypiserver_webhook
ports:
- "8633:8632"
volumes:
- ../../pypiserver/:/root/www/pypiserver/
command: ['bash', '-c', '/root/www/pypiserver/docker/start.sh']

start.sh

1
2
3
4
5
6
7
8
#!/bin/bash

# 获取当前文件所在目录
basepath=$(cd `dirname $0`; pwd)
cd $basepath
cd ../

nohup /root/app/python362/bin/gunicorn -c gunicorn.conf -t 60 server:app