1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

fix(container/network): recreate container changes static IP [EE-5448] (#8960)

Co-authored-by: Chaim Lev-Ari <chaim.levi-ari@portainer.io>
This commit is contained in:
Oscar Zhou 2023-05-30 09:36:10 +12:00 committed by GitHub
parent d340c4ea96
commit 96de026eba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1651 additions and 491 deletions

View file

@ -5,22 +5,23 @@ import (
"strings"
"time"
portainer "github.com/portainer/portainer/api"
"github.com/docker/docker/api/types"
_container "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
portainer "github.com/portainer/portainer/api"
dockerclient "github.com/portainer/portainer/api/docker/client"
"github.com/portainer/portainer/api/docker/consts"
"github.com/rs/zerolog/log"
)
// Snapshotter represents a service used to create environment(endpoint) snapshots
type Snapshotter struct {
clientFactory *ClientFactory
clientFactory *dockerclient.ClientFactory
}
// NewSnapshotter returns a new Snapshotter instance
func NewSnapshotter(clientFactory *ClientFactory) *Snapshotter {
func NewSnapshotter(clientFactory *dockerclient.ClientFactory) *Snapshotter {
return &Snapshotter{
clientFactory: clientFactory,
}
@ -202,7 +203,7 @@ func snapshotContainers(snapshot *portainer.DockerSnapshot, cli *client.Client)
}
for k, v := range container.Labels {
if k == ComposeStackNameLabel {
if k == consts.ComposeStackNameLabel {
stacks[v] = struct{}{}
}
}