[ Executor ] install docker ubuntu
This commit is contained in:
@@ -16,6 +16,10 @@ type AgentOsOperator struct {
|
|||||||
IsOsTypeUbuntu bool `json:"is_os_type_ubuntu",comment:"主机操作系统是否为ubuntu系列"`
|
IsOsTypeUbuntu bool `json:"is_os_type_ubuntu",comment:"主机操作系统是否为ubuntu系列"`
|
||||||
|
|
||||||
IsAgentInnerWall bool `json:"is_agent_inner_wall", comment:"主机是否身处国内"`
|
IsAgentInnerWall bool `json:"is_agent_inner_wall", comment:"主机是否身处国内"`
|
||||||
|
|
||||||
|
AgentArch string `json:"agent_arch",comment:"主机的CPU架构,可选为amd64 arm64"`
|
||||||
|
|
||||||
|
AgentOSReleaseCode string `json:"agent_os_release_code",comment:"主机操作系统的发行版代号, focal之类的"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec 执行基础功能函数
|
// Exec 执行基础功能函数
|
||||||
@@ -210,6 +214,10 @@ func (op *AgentOsOperator) installDocker(args []string) [][]string {
|
|||||||
"add",
|
"add",
|
||||||
"/etc/docker/docker-utsc.gpg",
|
"/etc/docker/docker-utsc.gpg",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"add-apt-repository",
|
||||||
|
"deb [arch=" + op.AgentArch + "] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu " + op.AgentOSReleaseCode + " stable",
|
||||||
|
},
|
||||||
}...)
|
}...)
|
||||||
} else {
|
} else {
|
||||||
// outside world
|
// outside world
|
||||||
@@ -218,18 +226,41 @@ func (op *AgentOsOperator) installDocker(args []string) [][]string {
|
|||||||
{
|
{
|
||||||
"curl",
|
"curl",
|
||||||
"-o",
|
"-o",
|
||||||
"/etc/docker/docker-utsc.gpg",
|
"/etc/docker/docker.gpg",
|
||||||
"https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg",
|
"https://download.docker.com/linux/ubuntu/gpg ",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"apt-key",
|
"apt-key",
|
||||||
"add",
|
"add",
|
||||||
"/etc/docker/docker-utsc.gpg",
|
"/etc/docker/docker.gpg",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"add-apt-repository",
|
||||||
|
"deb [arch=" + op.AgentArch + "] https://download.docker.com/linux/ubuntu " + op.AgentOSReleaseCode + " stable",
|
||||||
},
|
},
|
||||||
}...)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for specific docker-version to install
|
// look for specific docker-version to install
|
||||||
|
installDockerFunc = append(installDockerFunc, []string{"apt-get", "update"})
|
||||||
|
|
||||||
|
var specificDockerVersion string
|
||||||
|
// hard code here 5:20.10.10~3-0~ubuntu-focal
|
||||||
|
if strings.HasPrefix(args[0], "19") {
|
||||||
|
specificDockerVersion = "5:19.03.15~3-0~ubuntu-focal"
|
||||||
|
} else {
|
||||||
|
specificDockerVersion = "5:20.10.10~3-0~ubuntu-focal"
|
||||||
|
}
|
||||||
|
|
||||||
|
installDockerFunc = append(installDockerFunc,
|
||||||
|
append(
|
||||||
|
op.InstallCommandPrefix,
|
||||||
|
"docker-ce="+specificDockerVersion,
|
||||||
|
"docker-ce-cli="+specificDockerVersion,
|
||||||
|
"containerd.io",
|
||||||
|
"docker-compose-plugin",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
installFirstLine := append(op.InstallCommandPrefix,
|
installFirstLine := append(op.InstallCommandPrefix,
|
||||||
|
|||||||
Reference in New Issue
Block a user