mirror of
https://github.com/containers/podman.git
synced 2025-06-17 23:20:59 +08:00
Switch all referencs to image.ContainerConfig to image.Config
This will more closely match what Docker is doing. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -344,7 +344,7 @@ func configureEntrypoint(c *cli.Context, data *inspect.ImageData) []string {
|
||||
return []string{c.String("entrypoint")}
|
||||
}
|
||||
if data != nil {
|
||||
return data.ContainerConfig.Entrypoint
|
||||
return data.Config.Entrypoint
|
||||
}
|
||||
return entrypoint
|
||||
}
|
||||
@ -474,7 +474,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
||||
// EXPOSED PORTS
|
||||
var portBindings map[nat.Port][]nat.PortBinding
|
||||
if data != nil {
|
||||
portBindings, err = cc.ExposedPorts(c.StringSlice("expose"), c.StringSlice("publish"), c.Bool("publish-all"), data.ContainerConfig.ExposedPorts)
|
||||
portBindings, err = cc.ExposedPorts(c.StringSlice("expose"), c.StringSlice("publish"), c.Bool("publish-all"), data.Config.ExposedPorts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -567,7 +567,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
||||
if data == nil {
|
||||
user = "0"
|
||||
} else {
|
||||
user = data.ContainerConfig.User
|
||||
user = data.Config.User
|
||||
}
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
||||
stopSignal := syscall.SIGTERM
|
||||
signalString := ""
|
||||
if data != nil {
|
||||
signalString = data.ContainerConfig.StopSignal
|
||||
signalString = data.Config.StopSignal
|
||||
}
|
||||
if c.IsSet("stop-signal") {
|
||||
signalString = c.String("stop-signal")
|
||||
@ -590,7 +590,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
||||
// ENVIRONMENT VARIABLES
|
||||
env := defaultEnvVariables
|
||||
if data != nil {
|
||||
for _, e := range data.ContainerConfig.Env {
|
||||
for _, e := range data.Config.Env {
|
||||
split := strings.SplitN(e, "=", 2)
|
||||
if len(split) > 1 {
|
||||
env[split[0]] = split[1]
|
||||
@ -609,7 +609,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
||||
return nil, errors.Wrapf(err, "unable to process labels")
|
||||
}
|
||||
if data != nil {
|
||||
for key, val := range data.ContainerConfig.Labels {
|
||||
for key, val := range data.Config.Labels {
|
||||
if _, ok := labels[key]; !ok {
|
||||
labels[key] = val
|
||||
}
|
||||
@ -643,8 +643,8 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
||||
workDir := "/"
|
||||
if c.IsSet("workdir") || c.IsSet("w") {
|
||||
workDir = c.String("workdir")
|
||||
} else if data != nil && data.ContainerConfig.WorkingDir != "" {
|
||||
workDir = data.ContainerConfig.WorkingDir
|
||||
} else if data != nil && data.Config.WorkingDir != "" {
|
||||
workDir = data.Config.WorkingDir
|
||||
}
|
||||
|
||||
entrypoint := configureEntrypoint(c, data)
|
||||
@ -656,9 +656,9 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
||||
if len(inputCommand) > 0 {
|
||||
// User command overrides data CMD
|
||||
command = append(command, inputCommand...)
|
||||
} else if data != nil && len(data.ContainerConfig.Cmd) > 0 && !c.IsSet("entrypoint") {
|
||||
} else if data != nil && len(data.Config.Cmd) > 0 && !c.IsSet("entrypoint") {
|
||||
// If not user command, add CMD
|
||||
command = append(command, data.ContainerConfig.Cmd...)
|
||||
command = append(command, data.Config.Cmd...)
|
||||
}
|
||||
|
||||
if data != nil && len(command) == 0 {
|
||||
@ -697,7 +697,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
||||
|
||||
var ImageVolumes map[string]struct{}
|
||||
if data != nil {
|
||||
ImageVolumes = data.ContainerConfig.Volumes
|
||||
ImageVolumes = data.Config.Volumes
|
||||
}
|
||||
var imageVolType = map[string]string{
|
||||
"bind": "",
|
||||
|
@ -125,11 +125,11 @@ type Config struct {
|
||||
// don't result in runnable images on their own.
|
||||
// github.com/docker/distribution/manifest/schema1/config_builder.go
|
||||
type V1Compatibility struct {
|
||||
ID string `json:"id"`
|
||||
Parent string `json:"parent,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
ContainerConfig struct {
|
||||
ID string `json:"id"`
|
||||
Parent string `json:"parent,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
Created time.Time `json:"created"`
|
||||
Config struct {
|
||||
Cmd []string
|
||||
} `json:"container_config,omitempty"`
|
||||
Author string `json:"author,omitempty"`
|
||||
|
@ -39,15 +39,15 @@ func generateAlpineImageData() *inspect.ImageData {
|
||||
}
|
||||
|
||||
data := &inspect.ImageData{
|
||||
ID: "e21c333399e0aeedfd70e8827c9fba3f8e9b170ef8a48a29945eb7702bf6aa5f",
|
||||
RepoTags: []string{"docker.io/library/alpine:latest"},
|
||||
RepoDigests: []string{"docker.io/library/alpine@sha256:5cb04fce748f576d7b72a37850641de8bd725365519673c643ef2d14819b42c6"},
|
||||
Comment: "Created:2017-12-01 18:48:48.949613376 +0000",
|
||||
Author: "",
|
||||
Architecture: "amd64",
|
||||
Os: "linux",
|
||||
Version: "17.06.2-ce",
|
||||
ContainerConfig: config,
|
||||
ID: "e21c333399e0aeedfd70e8827c9fba3f8e9b170ef8a48a29945eb7702bf6aa5f",
|
||||
RepoTags: []string{"docker.io/library/alpine:latest"},
|
||||
RepoDigests: []string{"docker.io/library/alpine@sha256:5cb04fce748f576d7b72a37850641de8bd725365519673c643ef2d14819b42c6"},
|
||||
Comment: "Created:2017-12-01 18:48:48.949613376 +0000",
|
||||
Author: "",
|
||||
Architecture: "amd64",
|
||||
Os: "linux",
|
||||
Version: "17.06.2-ce",
|
||||
Config: config,
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ type PsOptions struct {
|
||||
// BatchContainerStruct is the return obkect from BatchContainer and contains
|
||||
// container related information
|
||||
type BatchContainerStruct struct {
|
||||
ConConfig *libpod.ContainerConfig
|
||||
ConConfig *libpod.Config
|
||||
ConState libpod.ContainerStatus
|
||||
ExitCode int32
|
||||
Exited bool
|
||||
@ -328,7 +328,7 @@ func PBatch(containers []*libpod.Container, workers int, opts PsOptions) []PsCon
|
||||
// locks.
|
||||
func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStruct, error) {
|
||||
var (
|
||||
conConfig *libpod.ContainerConfig
|
||||
conConfig *libpod.Config
|
||||
conState libpod.ContainerStatus
|
||||
err error
|
||||
exitCode int32
|
||||
|
@ -41,8 +41,8 @@ class Image(collections.UserDict):
|
||||
details = self.inspect()
|
||||
|
||||
config = ConfigDict(image_id=self._id, **kwargs)
|
||||
config['command'] = details.containerconfig.get('cmd')
|
||||
config['env'] = self._split_token(details.containerconfig.get('env'))
|
||||
config['command'] = details.config.get('cmd')
|
||||
config['env'] = self._split_token(details.config.get('env'))
|
||||
config['image'] = copy.deepcopy(details.repotags[0])
|
||||
config['labels'] = copy.deepcopy(details.labels)
|
||||
config['net_mode'] = 'bridge'
|
||||
|
@ -140,7 +140,7 @@ class TestContainers(PodmanTestCase):
|
||||
# TODO: Test for STOPSIGNAL when supported by OCI
|
||||
# TODO: Test for message when supported by OCI
|
||||
details = self.pclient.images.get(self.alpine_ctnr.image).inspect()
|
||||
changes = ['ENV=' + i for i in details.containerconfig['env']]
|
||||
changes = ['ENV=' + i for i in details.config['env']]
|
||||
changes.append('CMD=/usr/bin/zsh')
|
||||
changes.append('ENTRYPOINT=/bin/sh date')
|
||||
changes.append('ENV=TEST=test_containers.TestContainers.test_commit')
|
||||
@ -158,22 +158,22 @@ class TestContainers(PodmanTestCase):
|
||||
|
||||
details = img.inspect()
|
||||
self.assertEqual(details.author, 'Bozo the clown')
|
||||
self.assertListEqual(['/usr/bin/zsh'], details.containerconfig['cmd'])
|
||||
self.assertListEqual(['/usr/bin/zsh'], details.config['cmd'])
|
||||
self.assertListEqual(['/bin/sh date'],
|
||||
details.containerconfig['entrypoint'])
|
||||
details.config['entrypoint'])
|
||||
self.assertIn('TEST=test_containers.TestContainers.test_commit',
|
||||
details.containerconfig['env'])
|
||||
details.config['env'])
|
||||
self.assertTrue(
|
||||
[e for e in details.containerconfig['env'] if 'PATH=' in e])
|
||||
[e for e in details.config['env'] if 'PATH=' in e])
|
||||
self.assertDictEqual({
|
||||
'80': {},
|
||||
'8888': {},
|
||||
}, details.containerconfig['exposedports'])
|
||||
}, details.config['exposedports'])
|
||||
self.assertDictEqual({'unittest': 'test_commit'}, details.labels)
|
||||
self.assertEqual('bozo:circus', details.containerconfig['user'])
|
||||
self.assertEqual({'/data': {}}, details.containerconfig['volumes'])
|
||||
self.assertEqual('bozo:circus', details.config['user'])
|
||||
self.assertEqual({'/data': {}}, details.config['volumes'])
|
||||
self.assertEqual('/data/application',
|
||||
details.containerconfig['workingdir'])
|
||||
details.config['workingdir'])
|
||||
|
||||
def test_remove(self):
|
||||
before = len(self.containers)
|
||||
|
@ -69,7 +69,7 @@ class TestImages(PodmanTestCase):
|
||||
self.assertEqual(FoldedString(ctnr.status), 'running')
|
||||
|
||||
ctnr_details = ctnr.inspect()
|
||||
for e in img_details.containerconfig['env']:
|
||||
for e in img_details.config['env']:
|
||||
self.assertIn(e, ctnr_details.config['env'])
|
||||
|
||||
def test_export(self):
|
||||
|
@ -48,7 +48,7 @@ Display the total file size if the type is a container
|
||||
"Parent": "",
|
||||
"Comment": "",
|
||||
"Created": "2017-11-14T21:07:08.475840838Z",
|
||||
"ContainerConfig": {
|
||||
"Config": {
|
||||
"Env": [
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
"DISTTAG=f27container",
|
||||
|
@ -322,7 +322,7 @@ func (s *BoltState) Container(id string) (*Container, error) {
|
||||
ctrID := []byte(id)
|
||||
|
||||
ctr := new(Container)
|
||||
ctr.config = new(ContainerConfig)
|
||||
ctr.config = new(Config)
|
||||
ctr.state = new(containerState)
|
||||
|
||||
db, err := s.getDBCon()
|
||||
@ -358,7 +358,7 @@ func (s *BoltState) LookupContainer(idOrName string) (*Container, error) {
|
||||
}
|
||||
|
||||
ctr := new(Container)
|
||||
ctr.config = new(ContainerConfig)
|
||||
ctr.config = new(Config)
|
||||
ctr.state = new(containerState)
|
||||
|
||||
db, err := s.getDBCon()
|
||||
@ -751,7 +751,7 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
|
||||
}
|
||||
|
||||
ctr := new(Container)
|
||||
ctr.config = new(ContainerConfig)
|
||||
ctr.config = new(Config)
|
||||
ctr.state = new(containerState)
|
||||
|
||||
if err := s.getContainerFromDB(id, ctr, ctrBucket); err != nil {
|
||||
@ -1137,7 +1137,7 @@ func (s *BoltState) PodContainers(pod *Pod) ([]*Container, error) {
|
||||
// Iterate through all containers in the pod
|
||||
err = podCtrs.ForEach(func(id, val []byte) error {
|
||||
newCtr := new(Container)
|
||||
newCtr.config = new(ContainerConfig)
|
||||
newCtr.config = new(Config)
|
||||
newCtr.state = new(containerState)
|
||||
ctrs = append(ctrs, newCtr)
|
||||
|
||||
|
@ -18,7 +18,7 @@ import (
|
||||
|
||||
func getTestContainer(id, name, locksDir string) (*Container, error) {
|
||||
ctr := &Container{
|
||||
config: &ContainerConfig{
|
||||
config: &Config{
|
||||
ID: id,
|
||||
Name: name,
|
||||
RootfsImageID: id,
|
||||
@ -165,8 +165,8 @@ func testContainersEqual(t *testing.T, a, b *Container, allowedEmpty bool) {
|
||||
require.NotNil(t, a.state)
|
||||
require.NotNil(t, b.state)
|
||||
|
||||
aConfig := new(ContainerConfig)
|
||||
bConfig := new(ContainerConfig)
|
||||
aConfig := new(Config)
|
||||
bConfig := new(Config)
|
||||
aState := new(containerState)
|
||||
bState := new(containerState)
|
||||
|
||||
|
@ -112,7 +112,7 @@ func (ns LinuxNS) String() string {
|
||||
// syncContainer() immediately after locking.
|
||||
// ffjson: skip
|
||||
type Container struct {
|
||||
config *ContainerConfig
|
||||
config *Config
|
||||
|
||||
state *containerState
|
||||
|
||||
@ -199,11 +199,11 @@ type ExecSession struct {
|
||||
PID int `json:"pid"`
|
||||
}
|
||||
|
||||
// ContainerConfig contains all information that was used to create the
|
||||
// Config contains all information that was used to create the
|
||||
// container. It may not be changed once created.
|
||||
// It is stored, read-only, on disk
|
||||
// easyjson:json
|
||||
type ContainerConfig struct {
|
||||
type Config struct {
|
||||
Spec *spec.Spec `json:"spec"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@ -382,8 +382,8 @@ func (t ContainerStatus) String() string {
|
||||
// Unlocked
|
||||
|
||||
// Config returns the configuration used to create the container
|
||||
func (c *Container) Config() *ContainerConfig {
|
||||
returnConfig := new(ContainerConfig)
|
||||
func (c *Container) Config() *Config {
|
||||
returnConfig := new(Config)
|
||||
deepcopier.Copy(c.config).To(returnConfig)
|
||||
|
||||
return returnConfig
|
||||
|
@ -1238,7 +1238,7 @@ func (v *ExecSession) UnmarshalJSON(data []byte) error {
|
||||
func (v *ExecSession) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjson1dbef17bDecodeGithubComContainersLibpodLibpod1(l, v)
|
||||
}
|
||||
func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, out *ContainerConfig) {
|
||||
func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, out *Config) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
@ -1720,7 +1720,7 @@ func easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(in *jlexer.Lexer, ou
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, in ContainerConfig) {
|
||||
func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer, in Config) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
@ -2415,26 +2415,26 @@ func easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(out *jwriter.Writer,
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ContainerConfig) MarshalJSON() ([]byte, error) {
|
||||
func (v Config) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ContainerConfig) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
func (v Config) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjson1dbef17bEncodeGithubComContainersLibpodLibpod2(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ContainerConfig) UnmarshalJSON(data []byte) error {
|
||||
func (v *Config) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ContainerConfig) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
func (v *Config) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjson1dbef17bDecodeGithubComContainersLibpodLibpod2(l, v)
|
||||
}
|
||||
func easyjson1dbef17bDecodeGithubComContainersLibpodVendorGithubComCriOOcicniPkgOcicni(in *jlexer.Lexer, out *ocicni.PortMapping) {
|
||||
|
@ -1043,12 +1043,12 @@ func (c *Container) addLocalVolumes(ctx context.Context, g *generate.Generator,
|
||||
}
|
||||
// Add the built-in volumes of the container passed in to --volumes-from
|
||||
for _, vol := range c.config.LocalVolumes {
|
||||
if imageData.ContainerConfig.Volumes == nil {
|
||||
imageData.ContainerConfig.Volumes = map[string]struct{}{
|
||||
if imageData.Config.Volumes == nil {
|
||||
imageData.Config.Volumes = map[string]struct{}{
|
||||
vol: {},
|
||||
}
|
||||
} else {
|
||||
imageData.ContainerConfig.Volumes[vol] = struct{}{}
|
||||
imageData.Config.Volumes[vol] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1060,7 +1060,7 @@ func (c *Container) addLocalVolumes(ctx context.Context, g *generate.Generator,
|
||||
gid = execUser.Gid
|
||||
}
|
||||
|
||||
for k := range imageData.ContainerConfig.Volumes {
|
||||
for k := range imageData.Config.Volumes {
|
||||
mount := spec.Mount{
|
||||
Destination: k,
|
||||
Type: "bind",
|
||||
|
@ -28,7 +28,7 @@ func TestPostDeleteHooks(t *testing.T) {
|
||||
statePath := filepath.Join(dir, "state")
|
||||
copyPath := filepath.Join(dir, "copy")
|
||||
c := Container{
|
||||
config: &ContainerConfig{
|
||||
config: &Config{
|
||||
ID: "123abc",
|
||||
Spec: &rspec.Spec{
|
||||
Annotations: map[string]string{
|
||||
|
@ -832,21 +832,21 @@ func (i *Image) Inspect(ctx context.Context) (*inspect.ImageData, error) {
|
||||
}
|
||||
|
||||
data := &inspect.ImageData{
|
||||
ID: i.ID(),
|
||||
RepoTags: i.Names(),
|
||||
RepoDigests: repoDigests,
|
||||
Comment: comment,
|
||||
Created: ociv1Img.Created,
|
||||
Author: ociv1Img.Author,
|
||||
Architecture: ociv1Img.Architecture,
|
||||
Os: ociv1Img.OS,
|
||||
ContainerConfig: &ociv1Img.Config,
|
||||
Version: info.DockerVersion,
|
||||
Size: int64(*size),
|
||||
VirtualSize: int64(*size),
|
||||
Annotations: annotations,
|
||||
Digest: i.Digest(),
|
||||
Labels: info.Labels,
|
||||
ID: i.ID(),
|
||||
RepoTags: i.Names(),
|
||||
RepoDigests: repoDigests,
|
||||
Comment: comment,
|
||||
Created: ociv1Img.Created,
|
||||
Author: ociv1Img.Author,
|
||||
Architecture: ociv1Img.Architecture,
|
||||
Os: ociv1Img.OS,
|
||||
Config: &ociv1Img.Config,
|
||||
Version: info.DockerVersion,
|
||||
Size: int64(*size),
|
||||
VirtualSize: int64(*size),
|
||||
Annotations: annotations,
|
||||
Digest: i.Digest(),
|
||||
Labels: info.Labels,
|
||||
RootFS: &inspect.RootFS{
|
||||
Type: ociv1Img.RootFS.Type,
|
||||
Layers: ociv1Img.RootFS.DiffIDs,
|
||||
|
@ -1056,7 +1056,7 @@ func WithUserVolumes(volumes []string) CtrCreateOption {
|
||||
|
||||
// WithLocalVolumes sets the built-in volumes of the container retrieved
|
||||
// from a container passed in to the --volumes-from flag.
|
||||
// This stores the built-in volume information in the ContainerConfig so we can
|
||||
// This stores the built-in volume information in the Config so we can
|
||||
// add them when creating the container.
|
||||
func WithLocalVolumes(volumes []string) CtrCreateOption {
|
||||
return func(ctr *Container) error {
|
||||
|
@ -48,7 +48,7 @@ func (r *Runtime) newContainer(ctx context.Context, rSpec *spec.Spec, options ..
|
||||
}
|
||||
|
||||
ctr := new(Container)
|
||||
ctr.config = new(ContainerConfig)
|
||||
ctr.config = new(Config)
|
||||
ctr.state = new(containerState)
|
||||
|
||||
ctr.config.ID = stringid.GenerateNonCryptoID()
|
||||
|
@ -152,7 +152,7 @@ func TestGetContainerPodSameIDFails(t *testing.T) {
|
||||
|
||||
func TestAddInvalidContainerFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, lockPath string) {
|
||||
err := state.AddContainer(&Container{config: &ContainerConfig{ID: "1234"}})
|
||||
err := state.AddContainer(&Container{config: &Config{ID: "1234"}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
@ -752,7 +752,7 @@ func TestUpdateContainerNotInDatabaseReturnsError(t *testing.T) {
|
||||
|
||||
func TestUpdateInvalidContainerReturnsError(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, lockPath string) {
|
||||
err := state.UpdateContainer(&Container{config: &ContainerConfig{ID: "1234"}})
|
||||
err := state.UpdateContainer(&Container{config: &Config{ID: "1234"}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
@ -776,7 +776,7 @@ func TestUpdateContainerNotInNamespaceReturnsError(t *testing.T) {
|
||||
|
||||
func TestSaveInvalidContainerReturnsError(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, lockPath string) {
|
||||
err := state.SaveContainer(&Container{config: &ContainerConfig{ID: "1234"}})
|
||||
err := state.SaveContainer(&Container{config: &Config{ID: "1234"}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
@ -2600,7 +2600,7 @@ func TestAddContainerToPodInvalidCtr(t *testing.T) {
|
||||
err = state.AddPod(testPod)
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = state.AddContainerToPod(testPod, &Container{config: &ContainerConfig{ID: "1234"}})
|
||||
err = state.AddContainerToPod(testPod, &Container{config: &Config{ID: "1234"}})
|
||||
assert.Error(t, err)
|
||||
|
||||
ctrs, err := state.PodContainersByID(testPod)
|
||||
|
@ -106,27 +106,27 @@ type LogConfig struct {
|
||||
|
||||
// ImageData holds the inspect information of an image
|
||||
type ImageData struct {
|
||||
ID string `json:"Id"`
|
||||
Digest digest.Digest `json:"Digest"`
|
||||
RepoTags []string `json:"RepoTags"`
|
||||
RepoDigests []string `json:"RepoDigests"`
|
||||
Parent string `json:"Parent"`
|
||||
Comment string `json:"Comment"`
|
||||
Created *time.Time `json:"Created"`
|
||||
ContainerConfig *v1.ImageConfig `json:"ContainerConfig"`
|
||||
Version string `json:"Version"`
|
||||
Author string `json:"Author"`
|
||||
Architecture string `json:"Architecture"`
|
||||
Os string `json:"Os"`
|
||||
Size int64 `json:"Size"`
|
||||
VirtualSize int64 `json:"VirtualSize"`
|
||||
GraphDriver *Data `json:"GraphDriver"`
|
||||
RootFS *RootFS `json:"RootFS"`
|
||||
Labels map[string]string `json:"Labels"`
|
||||
Annotations map[string]string `json:"Annotations"`
|
||||
ManifestType string `json:"ManifestType"`
|
||||
User string `json:"User"`
|
||||
History []v1.History `json:"History"`
|
||||
ID string `json:"Id"`
|
||||
Digest digest.Digest `json:"Digest"`
|
||||
RepoTags []string `json:"RepoTags"`
|
||||
RepoDigests []string `json:"RepoDigests"`
|
||||
Parent string `json:"Parent"`
|
||||
Comment string `json:"Comment"`
|
||||
Created *time.Time `json:"Created"`
|
||||
Config *v1.ImageConfig `json:"Config"`
|
||||
Version string `json:"Version"`
|
||||
Author string `json:"Author"`
|
||||
Architecture string `json:"Architecture"`
|
||||
Os string `json:"Os"`
|
||||
Size int64 `json:"Size"`
|
||||
VirtualSize int64 `json:"VirtualSize"`
|
||||
GraphDriver *Data `json:"GraphDriver"`
|
||||
RootFS *RootFS `json:"RootFS"`
|
||||
Labels map[string]string `json:"Labels"`
|
||||
Annotations map[string]string `json:"Annotations"`
|
||||
ManifestType string `json:"ManifestType"`
|
||||
User string `json:"User"`
|
||||
History []v1.History `json:"History"`
|
||||
}
|
||||
|
||||
// RootFS holds the root fs information of an image
|
||||
|
@ -82,7 +82,7 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru
|
||||
// ENTRYPOINT
|
||||
// User input entrypoint takes priority over image entrypoint
|
||||
if len(entrypoint) == 0 {
|
||||
entrypoint = data.ContainerConfig.Entrypoint
|
||||
entrypoint = data.Config.Entrypoint
|
||||
}
|
||||
// if entrypoint=, we need to clear the entrypoint
|
||||
if len(entrypoint) == 1 && strings.Join(create.Entrypoint, "") == "" {
|
||||
@ -96,9 +96,9 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru
|
||||
if len(inputCommand) > 0 {
|
||||
// User command overrides data CMD
|
||||
command = append(command, inputCommand...)
|
||||
} else if len(data.ContainerConfig.Cmd) > 0 && len(command) == 0 {
|
||||
} else if len(data.Config.Cmd) > 0 && len(command) == 0 {
|
||||
// If not user command, add CMD
|
||||
command = append(command, data.ContainerConfig.Cmd...)
|
||||
command = append(command, data.Config.Cmd...)
|
||||
}
|
||||
|
||||
if create.Resources.Blkio_weight != 0 {
|
||||
@ -115,11 +115,11 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru
|
||||
|
||||
user := create.User
|
||||
if user == "" {
|
||||
user = data.ContainerConfig.User
|
||||
user = data.Config.User
|
||||
}
|
||||
|
||||
// EXPOSED PORTS
|
||||
portBindings, err := cc.ExposedPorts(create.Exposed_ports, create.Publish, create.Publish_all, data.ContainerConfig.ExposedPorts)
|
||||
portBindings, err := cc.ExposedPorts(create.Exposed_ports, create.Publish, create.Publish_all, data.Config.ExposedPorts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -143,7 +143,7 @@ func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, ru
|
||||
imageID := data.ID
|
||||
config := &cc.CreateConfig{
|
||||
Runtime: runtime,
|
||||
BuiltinImgVolumes: data.ContainerConfig.Volumes,
|
||||
BuiltinImgVolumes: data.Config.Volumes,
|
||||
ConmonPidFile: create.Conmon_pidfile,
|
||||
ImageVolumeType: create.Image_volume_type,
|
||||
CapAdd: create.Cap_add,
|
||||
|
@ -128,7 +128,7 @@ var _ = Describe("Podman commit", func() {
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect.ExitCode()).To(Equal(0))
|
||||
image := inspect.InspectImageJSON()
|
||||
_, ok := image[0].ContainerConfig.Volumes["/tmp"]
|
||||
_, ok := image[0].Config.Volumes["/tmp"]
|
||||
Expect(ok).To(BeTrue())
|
||||
|
||||
r := podmanTest.Podman([]string{"run", "newimage"})
|
||||
|
@ -106,7 +106,7 @@ var _ = Describe("Podman import", func() {
|
||||
results.WaitWithDefaultTimeout()
|
||||
Expect(results.ExitCode()).To(Equal(0))
|
||||
imageData := results.InspectImageJSON()
|
||||
Expect(imageData[0].ContainerConfig.Cmd[0]).To(Equal("/bin/bash"))
|
||||
Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/bash"))
|
||||
})
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user