Skip to content

Commit

Permalink
优化docker安装, 提高成功率
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Mar 28, 2020
1 parent 589fdee commit e2e0fb9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions trojan/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
)

var (
dockerInstallUrl = "https://git.io/docker-install"
mysqlDodkcerRun = "docker run --name trojan-mysql --restart=always -p %d:3306 -v /home/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=%s -e MYSQL_ROOT_HOST=%% -e MYSQL_DATABASE=trojan -d mysql/mysql-server:5.7"
dockerInstallUrl1 = "https://get.docker.com"
dockerInstallUrl2 = "https://git.io/docker-install"
mysqlDodkcerRun = "docker run --name trojan-mysql --restart=always -p %d:3306 -v /home/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=%s -e MYSQL_ROOT_HOST=%% -e MYSQL_DATABASE=trojan -d mysql/mysql-server:5.7"
)

// InstallMenu 安装目录
Expand All @@ -35,7 +36,13 @@ func InstallMenu() {
// InstallDocker 安装docker
func InstallDocker() {
if !util.CheckCommandExists("docker") {
util.RunWebShell(dockerInstallUrl)
util.RunWebShell(dockerInstallUrl1)
if !util.CheckCommandExists("docker") {
util.RunWebShell(dockerInstallUrl2)
} else {
util.ExecCommand("systemctl enable docker")
util.ExecCommand("systemctl start docker")
}
fmt.Println()
}
}
Expand Down

0 comments on commit e2e0fb9

Please sign in to comment.