diff --git a/.gitignore b/.gitignore index b75d241..1f372c8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ venv __pycache__ env.py env.slave.py -env.docker.py \ No newline at end of file +env.docker.py +docker-compose.yml \ No newline at end of file diff --git a/README.md b/README.md index d36b51c..a1e820c 100644 --- a/README.md +++ b/README.md @@ -100,14 +100,14 @@ docker run --rm --name py12306 -p 8008:8008 -d -v $(pwd):/config -v py12306:/dat ``` 当前目录会多一个 12306.log 的日志文件, `tail -f 12306.log` -## Docker-compose 使用 -**1. 在py12306目录下创建config目录** -```mkdir config``` +### Docker-compose 中使用 +**1. 复制配置文件** +``` +cp docker-compose.yml.example docker-compose.yml +``` -**2. 修改配置文件** -在`config`目录下,根据自己的个人配置创建`env.py`文件 +**2. 从 docker-compose 运行** -**3. 运行docker程序** 在`docker-compose.yml`所在的目录使用命令 ``` docker-compose up -d diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 0a94e9c..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: "2" -services: - go_home: - build: . - volumes: - - ./config:/config - ports: - - 18008:8008 \ No newline at end of file diff --git a/docker-compose.yml.example b/docker-compose.yml.example new file mode 100644 index 0000000..6813067 --- /dev/null +++ b/docker-compose.yml.example @@ -0,0 +1,12 @@ +version: "2" +services: + py12306: + build: . + volumes: + - ./env.py:/config/env.py + - py12306:/data + ports: + - 8008:8008 + +volumes: + py12306: