diff --git a/asset/Dockerfile b/asset/Dockerfile index 94a69987..b367b70e 100644 --- a/asset/Dockerfile +++ b/asset/Dockerfile @@ -6,10 +6,12 @@ ENV VERSION_CHECK "https://api.github.com/repos/Jrohy/trojan/releases/latest" ENV DOWNLAOD_URL "https://github.com/Jrohy/trojan/releases/download/" -RUN yum install socat bash-completion -y && \ +RUN yum install socat bash-completion iptables -y && \ LATEST_VERSION=`curl -H 'Cache-Control: no-cache' -s "$VERSION_CHECK" | grep 'tag_name' | cut -d\" -f4` && \ curl -L "$DOWNLAOD_URL/$LATEST_VERSION/trojan" -o /usr/local/bin/trojan && \ chmod +x /usr/local/bin/trojan && \ echo "source <(trojan completion bash)" >> ~/.bashrc && \ + touch /.run.log && \ yum clean all - \ No newline at end of file + +ENTRYPOINT ["tail", "-f", "/.run.log"] \ No newline at end of file diff --git a/asset/docker_tip.txt b/asset/docker_tip.txt index 1fff2ec2..40b86160 100644 --- a/asset/docker_tip.txt +++ b/asset/docker_tip.txt @@ -1,7 +1,3 @@ docker 运行 - -#systemctl可用 -docker run -d --name test --net=host --privileged trojan-manager init -#容器里面操作容器 -docker run -it -d --name test -v /var/run/docker.sock:/var/run/docker.sock -v `which docker`:`which docker` centos tail -f +docker run -it -d --name test --net=host --privileged -v /var/run/docker.sock:/var/run/docker.sock -v `which docker`:`which docker` jrohy/trojan diff --git a/asset/trojan-install.sh b/asset/trojan-install.sh index b534f348..27bca24d 100644 --- a/asset/trojan-install.sh +++ b/asset/trojan-install.sh @@ -58,7 +58,7 @@ else echo Skipping installing $NAME server config... fi -if [[ -d "$SYSTEMDPREFIX" ]]; then +if [[ ! -e "/.dockerenv" && -d "$SYSTEMDPREFIX" ]]; then echo Installing $NAME systemd service to $SYSTEMDPATH... if ! [[ -f "$SYSTEMDPATH" ]] || prompt "The systemd service already exists in $SYSTEMDPATH, overwrite?"; then cat > "$SYSTEMDPATH" << EOF diff --git a/cmd/version.go b/cmd/version.go index 947c73f5..8452b52a 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -22,7 +22,7 @@ import ( "github.com/spf13/cobra" ) -const VERSION = "v1.2.0" +const VERSION = "v1.3.0" // versionCmd represents the version command var versionCmd = &cobra.Command{ diff --git a/trojan/trojan.go b/trojan/trojan.go index 533c9af7..a80a4c38 100644 --- a/trojan/trojan.go +++ b/trojan/trojan.go @@ -54,7 +54,7 @@ func Start() { func Stop() { if util.IsExists("/.dockerenv") { - util.ExecCommand(`ps aux|grep "/usr/bin/trojan/trojan"|grep -v grep|awk '{print $2}'|xargs -r kill -9 2>/dev/null`) + util.ExecCommandWithResult(`ps aux|grep "/usr/bin/trojan/trojan"|grep -v grep|awk '{print $2}'|xargs -r kill -9`) fmt.Println(util.Green("停止trojan成功!")) } else { if err := util.ExecCommand("systemctl stop trojan"); err != nil {