Skip to content

Commit 7b03867

Browse files
committed
remove docker upgrade check
1 parent 10864b5 commit 7b03867

File tree

1 file changed

+0
-61
lines changed

1 file changed

+0
-61
lines changed

goseg/docker/docker.go

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"groundseg/structs"
1010
"io"
1111
"io/ioutil"
12-
"os/exec"
1312
"path/filepath"
1413
"strings"
1514
"time"
@@ -52,9 +51,6 @@ func init() {
5251
version, err := cli.ServerVersion(context.TODO())
5352
if err != nil {
5453
zap.L().Error(fmt.Sprintf("Error getting Docker version: %v", err))
55-
if strings.Contains(err.Error(), "is too new") {
56-
updateDocker()
57-
}
5854
return
5955
}
6056
//go getContainerStats()
@@ -97,63 +93,6 @@ func killContainerUsingPort(n uint16) error {
9793
return nil
9894
}
9995

100-
// attempt to update docker daemon (ubuntu/mint only)
101-
func updateDocker() {
102-
zap.L().Info("Unsupported Docker version detected -- attempting to upgrade")
103-
packages := []string{"docker.io", "docker-doc", "docker-compose", "podman-docker", "containerd", "runc"}
104-
for _, pkg := range packages {
105-
out, err := exec.Command("apt-get", "remove", "-y", pkg).CombinedOutput()
106-
if err != nil {
107-
zap.L().Error(fmt.Sprintf("Couldn't update Docker: error removing package %s: %v\n%s", pkg, err, out))
108-
return
109-
}
110-
}
111-
commands := []string{
112-
"apt-get update",
113-
"apt-get install -y ca-certificates curl gnupg",
114-
"install -m 0755 -d /etc/apt/keyrings",
115-
`curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg`, // Added --yes
116-
"chmod a+r /etc/apt/keyrings/docker.gpg",
117-
}
118-
for _, cmd := range commands {
119-
out, err := exec.Command("sh", "-c", cmd).CombinedOutput()
120-
if err != nil {
121-
zap.L().Error(fmt.Sprintf("Error executing command '%s': %v\n%s", cmd, err, out))
122-
}
123-
}
124-
out, err := exec.Command("sh", "-c", ". /etc/os-release && echo $VERSION_CODENAME").Output()
125-
if err != nil {
126-
zap.L().Error(fmt.Sprintf("Couldn't update Docker: Error fetching version codename: %v\n%s", err, out))
127-
return
128-
}
129-
codename := strings.TrimSpace(string(out))
130-
if contains([]string{"ulyana", "ulyssa", "uma", "una"}, codename) {
131-
codename = "focal"
132-
} else if contains([]string{"vanessa", "vera", "victoria"}, codename) {
133-
codename = "jammy"
134-
}
135-
archOut, archErr := exec.Command("sh", "-c", "dpkg --print-architecture").Output()
136-
if archErr != nil {
137-
zap.L().Error(fmt.Sprintf("Couldn't update Docker: Error fetching system architecture: %v\n%s", archErr, archOut))
138-
return
139-
}
140-
architecture := strings.TrimSpace(string(archOut))
141-
sourcesList := fmt.Sprintf("deb [arch=%s signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu %s stable", architecture, codename)
142-
cmd := fmt.Sprintf("echo '%s' | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null", sourcesList)
143-
out, err = exec.Command("sh", "-c", cmd).CombinedOutput()
144-
if err != nil {
145-
zap.L().Error(fmt.Sprintf("Couldn't update Docker: Error updating Docker sources list: %v\n%s", err, out))
146-
return
147-
}
148-
dockerPackages := []string{"install", "-y", "docker-ce", "docker-ce-cli", "containerd.io"}
149-
out, err = exec.Command("apt-get", dockerPackages...).CombinedOutput()
150-
if err != nil {
151-
zap.L().Error(fmt.Sprintf("Couldn't update Docker: Error installing Docker packages: %v\n%s", err, out))
152-
return
153-
}
154-
zap.L().Info("Successfully updated Docker")
155-
}
156-
15796
// return the container status of a slice of ships
15897
func GetShipStatus(patps []string) (map[string]string, error) {
15998
statuses := make(map[string]string)

0 commit comments

Comments
 (0)