diff --git a/docs/containers.conf.5.md b/docs/containers.conf.5.md index affcc4595..829d87d51 100644 --- a/docs/containers.conf.5.md +++ b/docs/containers.conf.5.md @@ -490,6 +490,12 @@ Indicates if Podman is running inside a VM via Podman Machine. Podman uses this value to do extra setup around networking from the container inside the VM to to host. +**machine_type**="" + +Indicates the type of machine if Podman is running inside a podman machine +instance. The value is only relevant if machine_enabled is true. The default +value (empty string) indicates the machine type is unknown. + **multi_image_archive**=false Allows for creating archives (e.g., tarballs) with more than one image. Some container engines, such as Podman, interpret additional arguments as tags for one image and hence do not store more than one image. The default behavior can be altered with this option. diff --git a/pkg/config/config.go b/pkg/config/config.go index 8d2839cc7..37a097e7f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -304,6 +304,10 @@ type EngineConfig struct { // MachineEnabled indicates if Podman is running in a podman-machine VM MachineEnabled bool `toml:"machine_enabled,omitempty"` + // MachineType indicates the type of machine if Podman is running inside a + // podman-machine instance + MachineType string `toml:"machine_type,omitempty"` + // MultiImageArchive - if true, the container engine allows for storing // archives (e.g., of the docker-archive transport) with multiple // images. By default, Podman creates single-image archives. diff --git a/pkg/config/config_local_test.go b/pkg/config/config_local_test.go index 59e565203..654e4ac56 100644 --- a/pkg/config/config_local_test.go +++ b/pkg/config/config_local_test.go @@ -376,6 +376,18 @@ var _ = Describe("Config Local", func() { gomega.Expect(config2.Engine.MachineEnabled).To(gomega.Equal(true)) }) + It("Set Machine Type", func() { + // Given + config, err := NewConfig("") + gomega.Expect(err).To(gomega.BeNil()) + gomega.Expect(config.Engine.MachineType).To(gomega.Equal("")) + // When + config2, err := NewConfig("testdata/containers_default.conf") + // Then + gomega.Expect(err).To(gomega.BeNil()) + gomega.Expect(config2.Engine.MachineType).To(gomega.Equal("wsl")) + }) + It("default netns", func() { // Given config, err := NewConfig("") diff --git a/pkg/config/default.go b/pkg/config/default.go index aa7ce1475..990101c57 100644 --- a/pkg/config/default.go +++ b/pkg/config/default.go @@ -381,6 +381,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) { // constants. c.LockType = "shm" c.MachineEnabled = false + c.MachineType = "" c.ChownCopiedFiles = true return c, nil diff --git a/pkg/config/testdata/containers_default.conf b/pkg/config/testdata/containers_default.conf index 25f8a1c54..ea1380742 100644 --- a/pkg/config/testdata/containers_default.conf +++ b/pkg/config/testdata/containers_default.conf @@ -156,6 +156,7 @@ env = ["super=duper", "foo=bar"] tmp_dir = "/run/libpod" machine_enabled = true +machine_type = "wsl" # Whether to use chroot instead of pivot_root in the runtime no_pivot_root = false