diff --git a/README.md b/README.md index 14dcf78..71cb10c 100755 --- a/README.md +++ b/README.md @@ -22,16 +22,14 @@ - 由于新增对时功能,请务必用sudo,sudo,sudo 执行,否则会报权限错误,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安装脚本(**centos7**) + - `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) diff --git a/docker-compose.yml b/docker-compose.yml index f570b8f..9179411 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/docker_install_centos.sh b/docker_install_centos.sh new file mode 100755 index 0000000..c43814e --- /dev/null +++ b/docker_install_centos.sh @@ -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 +