Merge pull request #195 from MonsterTan/master

docker update
pull/197/head
wenxianping 6 years ago committed by GitHub
commit e0fee69e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -22,16 +22,14 @@
- 由于新增对时功能请务必用sudosudosudo 执行否则会报权限错误windows打开ide或者cmd请用管理员身份执行python run.py不需要加sudo
- 如果你的服务器安装了docker与docker-compose, 那么就可以通过`docker-compose`进行启动,`docker.sh`脚本对此进行了封装,可以通过如下命令进行启动
- 1、`sudo ./docker.sh run` #创建一个镜像并启动容器,如果镜像已经创建过了会直接启动容器。
- 2、`sudo ./docker.sh reload` #修改配置文件后,通过此名命令可重新加载容器运行
- 2、`sudo ./docker.sh restart` #修改配置文件后,通过此名命令可重新加载容器运行
- 3、`sudo ./docker.sh rm` #删除容器
- 4、`sudo ./docker.sh drun` #后台运行容器
- 5、`sudo ./docker.sh logs` #在后台运行时,通过此命令查看运行的内容
- 注: 若只有docker没有docker-compose. 可通过`pip install docker-compose`进行下载
- ~~如果你的服务器安装了docker那么就可以docker启动~~
- 1、~~docker build -t dockerticket .~~
- 2、~~docker run dockerticket python run.py &~~
- 3、~~本来是可以直接Dockerfile启动的不知道为毛启动不了如果有大佬看到问题所在欢迎提出~~
- 4、~~docker run -d --name 12306-ticket dockerticket~~
- 注: 针对没有docker环境的同学提供了docker安装脚本(**<font color="red">centos7</font>**)
- `sudo ./docker_install_centos.sh`
- ~~注: 若只有docker没有docker-compose. 可通过`pip install docker-compose`进行下载~~
@ -91,7 +89,7 @@
- 感谢一下小伙伴对本项目提供的帮助
- @sun7127@126.com
- @ 才
- @MonsterTan
- @[MonsterTan](https://github.com/MonsterTan)
- 以及所有为此项目提供pr的同学
- [更新日志](Update.md)

@ -7,7 +7,8 @@ services:
# ports:
volumes:
- ./:/usr/src/app
- /etc/localtime:/etc/localtime:ro
# - /etc/localtime:/etc/localtime:ro
container_name: 12306ticket
privileged: true

@ -0,0 +1,45 @@
#!/bin/bash
#author: MonsterTan
#date: 2019-01-15
#this is a script that can install automatically docker software by centos7
function checkSudo (){
if [ $UID -ne 0 ];then
echo -e 'it must be root!'
exit 1
fi
}
checkSudo
## something required system utils
yum install -y yum-utils device-mapper-persistent-data lvm2
## add repo source info
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum mackecache fast
sudo yum -y install docker-ce
sudo systemctl start docker
str=successed!
if [ $? -eq 0 ];then
echo -e "\033[32msuccessed!\033[0m"
else
echo -e "\033[31msomething wrong, please check!\033[0m"
fi
echo -e "\033[31mstart to install docker-compose\033[0m"
result=`ls /usr/bin/ | grep ^pip$`
if [ ${#result} -eq 0 ];then
echo -e "\033[31mpip must be necessary, it should be installed firstly\033[0m"
fi
sudo pip install docker-compose
Loading…
Cancel
Save