mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-05 06:04:35 +08:00
fix: Fix container image upgrade command loss issue
This commit is contained in:
parent
5a0c50b9a2
commit
d3d8e1c4c3
1 changed files with 0 additions and 28 deletions
|
@ -805,14 +805,6 @@ func (u *ContainerService) ContainerUpgrade(req dto.ContainerUpgrade) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
inspected, err := client.ImageInspect(ctx, req.Image)
|
||||
if err != nil {
|
||||
return fmt.Errorf("inspect image failed, err: %v", err)
|
||||
}
|
||||
if isDynamicImage(inspected) {
|
||||
oldContainer.Config.Entrypoint = nil
|
||||
oldContainer.Config.Cmd = nil
|
||||
}
|
||||
return nil
|
||||
}, nil)
|
||||
|
||||
|
@ -1743,23 +1735,3 @@ func loadContainerPortForInfo(itemPorts []container.Port) []dto.PortHelper {
|
|||
}
|
||||
return exposedPorts
|
||||
}
|
||||
|
||||
func isDynamicImage(inspected image.InspectResponse) bool {
|
||||
if len(inspected.Config.Entrypoint) > 0 {
|
||||
entrypointStr := strings.Join(inspected.Config.Entrypoint, " ")
|
||||
if strings.Contains(entrypointStr, "entrypoint") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
dirs := []string{"/docker-entrypoint.d", "/docker-entrypoint-initdb.d"}
|
||||
for _, dir := range dirs {
|
||||
for _, layer := range inspected.RootFS.Layers {
|
||||
if strings.Contains(layer, dir) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue