Skip to content

Commit 668e71a

Browse files
committed
Keep a copy of the container's runtime spec
When we start a container, stash a copy of the runtime spec that we generated for it in the container object. Signed-off-by: Nalin Dahyabhai <[email protected]>
1 parent c3e3cab commit 668e71a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

container/container.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import (
4343
"github.com/docker/libnetwork/types"
4444
agentexec "github.com/docker/swarmkit/agent/exec"
4545
"github.com/opencontainers/runc/libcontainer/label"
46+
specs "github.com/opencontainers/runtime-spec/specs-go"
4647
)
4748

4849
const configFileName = "config.v2.json"
@@ -85,6 +86,7 @@ type CommonContainer struct {
8586
HasBeenManuallyStopped bool // used for unless-stopped restart policy
8687
MountPoints map[string]*volume.MountPoint
8788
HostConfig *containertypes.HostConfig `json:"-"` // do not serialize the host config in the json, otherwise we'll make the container unportable
89+
Spec *specs.Spec `json:"-"` // ditto
8890
ExecCommands *exec.Store `json:"-"`
8991
SecretStore agentexec.SecretGetter `json:"-"`
9092
SecretReferences []*swarmtypes.SecretReference

daemon/start.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint
157157
if err != nil {
158158
return err
159159
}
160+
container.Spec = spec
160161

161162
createOptions, err := daemon.getLibcontainerdCreateOptions(container)
162163
if err != nil {

0 commit comments

Comments
 (0)