Merge pull request #34 from rhatdan/manpage

Update/Fix man page and fix several bugs in definition.
This commit is contained in:
Daniel J Walsh 2020-01-03 14:03:36 -05:00 committed by GitHub
commit cc5cb58fc3
9 changed files with 542 additions and 316 deletions

View File

@ -7,6 +7,8 @@ ifeq ($(shell go help mod >/dev/null 2>&1 && echo true), true)
GO_BUILD=GO111MODULE=on $(GO) build -mod=vendor
endif
DESTDIR ?=
PREFIX := /usr/local
CONFIGDIR := ${PREFIX}/share/containers
PROJECT := github.com/containers/common
# If GOPATH not specified, use one in the local directory
@ -57,6 +59,13 @@ install.tools: .install.golangci-lint .install.md2man
$(call go-get,github.com/cpuguy83/go-md2man); \
fi
.PHONY: install
install:
install -d ${DESTDIR}/${CONFIGDIR}
install -m 0644 pkg/config/containers.conf ${DESTDIR}/${CONFIGDIR}/containers.conf
$(MAKE) -C docs install
.PHONY: test
test: test-unit
@ -66,7 +75,5 @@ test-unit:
clean: ## Clean artifacts
$(MAKE) -C docs clean
rm -rf \
bin
find . -name \*~ -delete
find . -name \#\* -delete
find . -name \#\* -delete

View File

@ -3,16 +3,16 @@ DATADIR := ${PREFIX}/share
MANDIR := $(DATADIR)/man
GOMD2MAN ?= $(shell command -v go-md2man || echo '$(GOBIN)/go-md2man')
docs: $(patsubst %.md,%.1,$(wildcard *.md))
docs: $(patsubst %.md,%,$(wildcard *.md))
%.1: %.md
%.5: *md
$(GOMD2MAN) -in $^ -out $@
.PHONY: install
install:
install -d ${DESTDIR}/${MANDIR}/man1
install -m 0644 common*.1 ${DESTDIR}/${MANDIR}/man1
install -d ${DESTDIR}/${MANDIR}/man5
install -m 0644 *.5 ${DESTDIR}/${MANDIR}/man5
.PHONY: clean
clean:
$(RM) common*.1
$(RM) *.5

View File

@ -0,0 +1,346 @@
% containers.conf(5) Container engine configuration file
# NAME
containers.conf - The container engine configuration file specifies default
configuration options and command-line flags for container engines.
# DESCRIPTION
Container engines like Podman & Buildah read containers.conf file, if it exists
and modify the defaults for running containers on the host. containers.conf uses
a TOML format that can be easily modified and versioned.
Container engines read the /usr/share/containers/containers.conf and
/etc/containers/containers.conf files if they exists. When running in rootless
mode, they also read $HOME/.config/containers/containers.conf files.
Fields specified in containers conf override the default options, as well as
options in previously read containers.conf files.
Not all options are supported in all container engines.
Note container engines also use other configuration files for configuring the environment.
* `storage.conf` for configuration of container and images storage.
* `registries.conf` for definition of container registires to search while pulling.
container images.
* `policy.conf` for controlling which images can be pulled to the system.
# FORMAT
The [TOML format][toml] is used as the encoding of the configuration file.
Every option is nested under its table. No bare options are used. The format of
TOML can be simplified to:
[table1]
option = value
[table2]
option = value
[table3]
option = value
[table3.subtable1]
option = value
## CONTAINERS TABLE
The containers table contains settings pertaining to the OCI runtime that can
configure and manage the OCI runtime.
**additional_devices**=[]
List of additional devices.
Specified as 'device-on-host:device-on-container:permissions',
for example: "/dev/sdc:/dev/xvdc:rwm".
**additional_volumes**=[]
List of additional volumes.
Specified as "directory-on-host:directory-in-container:options",
for example: "/db:/var/lib/db:ro".
**apparmor_profile**="container-default"
Used to change the name of the default AppArmor profile of container engines.
The default profile name is "container-default".
**cgroupns**="private"
Default way to to create a cgroup namespace for the container.
Options are:
`private` Create private Cgroup Namespace for the container.
`host` Share host Cgroup Namespace with the container.
**cgroup_manager**="systemd"
The cgroup management implementation used for the runtime. Supports `cgroupfs`
and `systemd`.
**default_capabilities**=[]
List of default capabilities for containers.
The default list is:
```
default_capabilities = [
"AUDIT_WRITE",
"CHOWN",
"DAC_OVERRIDE",
"FOWNER",
"FSETID",
"KILL",
"MKNOD",
"NET_BIND_SERVICE",
"NET_RAW",
"SETGID",
"SETPCAP",
"SETUID",
"SYS_CHROOT",
]
```
**default_sysctls**=[]
A list of sysctls to be set in containers by default,
specified as "name=value",
for example:"net.ipv4.ping_group_range=0 1000".
**default_ulimits**=[]
A list of ulimits to be set in containers by default,
specified as "name=soft-limit:hard-limit",
for example:"nofile=1024:2048".
**dns_options**=[]
List of default DNS options to be added to /etc/resolv.conf inside of the
container.
**dns_searches**=[]
List of default DNS search domains to be added to /etc/resolv.conf inside of
the container.
**dns_servers**=[]
A list of dns servers to override the DNS configuration passed to the
container. The special value “none” can be specified to disable creation of
/etc/resolv.conf in the container.
**env**=["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"]
Environment variable list for the container process, used for passing
environment variables to the container.
**env_host**=false
Pass all host environment variables into the container.
**hooks_dir**=["/etc/containers/oci/hooks.d", ...]
Path to the OCI hooks directories for automatically executed hooks.
**http_proxy**=false
Default proxy environment variables will be passed into the container.
The environment variables passed in include:
`http_proxy`, `https_proxy`, `ftp_proxy`, `no_proxy`, and the upper case
versions of these. The `no_proxy` option is needed when host system uses a proxy
but container should not use proxy. Proxy environment variables specified for
the container in any other way will override the values passed from the host.
**init**=false
Run an init inside the container that forwards signals and reaps processes.
**init_path**="/usr/libexec/podman/catatonit"
Path to the container-init binary, which forwards signals and reaps processes
within containers. Note that the container-init binary will only be used when
the `--init` for podman-create and podman-run is set.
**ipcns**="private"
Default way to to create a IPC namespace for the container.
Options are:
`private` Create private IPC Namespace for the container.
`host` Share host IPC Namespace with the container.
**label**=true
Indicates whether the container engines use MAC(SELinux) container separation via via labeling. Flag is ignored on disabled systems.
**log_driver**="k8s-file"
Logging driver for the container. Available options: `k8s-file` and `journald`.
**log_size_max**=-1
Maximum size allowed for the container's log file. Negative numbers indicate
that no size limit is imposed. If it is positive, it must be >= 8192 to
match/exceed conmon's read buffer. The file is truncated and re-opened so the
limit is never exceeded.
**netns**="private"
Default way to to create a NET namespace for the container.
Options are:
`private` Create private NET Namespace for the container.
`host` Share host NET Namespace with the container.
`none` Containers do not use the network.
**no_hosts**=false
Create /etc/hosts for the container. By default, container engines manage
/etc/hosts, automatically adding the container's own IP address.
**pids_limit**=1024
Maximum number of processes allowed in a container. 0 indicates that no limit
is imposed.
**pidns**="private"
Default way to to create a PID namespace for the container.
Options are:
`private` Create private PID Namespace for the container.
`host` Share host PID Namespace with the container.
**seccomp_profile**="/usr/share/containers/seccomp.json"
Path to the seccomp.json profile which is used as the default seccomp profile
for the runtime.
**shm_size**="65536k"
Size of `/dev/shm`. The format is `<number><unit>`. `number` must be greater
than `0`.
Unit is optional and can be:
`b` (bytes), `k` (kilobytes), `m`(megabytes), or `g` (gigabytes).
If you omit the unit, the system uses bytes. If you omit the size entirely,
the system uses `65536k`.
**utsns**="private"
Default way to to create a UTS namespace for the container.
Options are:
`private` Create private UTS Namespace for the container.
`host` Share host UTS Namespace with the container.
**userns**="host"
Default way to to create a USER namespace for the container.
Options are:
`private` Create private USER Namespace for the container.
`host` Share host USER Namespace with the container.
**userns_size**=65536
Number of UIDs to allocate for the automatic container creation. UIDs are
allocated from the “container” UIDs listed in /etc/subuid & /etc/subgid.
## NETWORK TABLE
The `network` table contains settings pertaining to the management of CNI
plugins.
**cni_plugin_dirs**=["/opt/cni/bin/",]
List of paths to directories where CNI plugin binaries are located.
**default_network**="podman"
The network name of the default CNI network to attach pods to.
**network_config_dir**="/etc/cni/net.d/"
Path to the directory where CNI configuration files are located.
## LIBPOD TABLE
The `libpod` table contains configuration options used to set up a libpod runtime.
**conmon_env_vars**=[]
Environment variables to pass into Conmon.
**conmon_path**=[]
Paths to search for the conmon container manager binary. If the paths are
empty or no valid path was found, then the `$PATH` environment variable will be
used as the fallback.
The default list is:
```
conmon_path=[
"/usr/libexec/podman/conmon",
"/usr/local/libexec/podman/conmon",
"/usr/local/lib/podman/conmon",
"/usr/bin/conmon",
"/usr/sbin/conmon",
"/usr/local/bin/conmon",
"/usr/local/sbin/conmon",
"/run/current-system/sw/bin/conmon",
]
```
**detach_keys**="ctrl-p,ctrl-q"
Keys sequence used for detaching a container.
Specify the keys sequence used to detach a container.
Format is a single character `[a-Z]` or a comma separated sequence of
`ctrl-<value>`, where `<value>` is one of:
`a-z`, `@`, `^`, `[`, `\`, `]`, `^` or `_`
**enable_port_reservation**=true
Determines whether libpod will reserve ports on the host when they are
forwarded to containers. When enabled, when ports are forwarded to containers,
they are held open by conmon as long as the container is running, ensuring that
they cannot be reused by other programs on the host. However, this can cause
significant memory usage if a container has many ports forwarded to it.
Disabling this can save memory.
**events_logger**="journald"
Default method to use when logging events.
Valid values: `file`, `journald`, and `none`.
**image_default_transport**="docker://"
Default transport method for pulling and pushing images.
**infra_command**="/pause"
Command to run the infra container.
**infra_image**="k8s.gcr.io/pause:3.1"
Infra (pause) container image name for pod infra containers. When running a
pod, we start a `pause` process in a container to hold open the namespaces
associated with the pod. This container does nothing other then sleep,
reserving the pods resources for the lifetime of the pod.
**lock_type**="shm"
Specify the locking mechanism to use; valid values are "shm" and "file".
Change the default only if you are sure of what you are doing, in general
"file" is useful only on platforms where cgo is not available for using the
faster "shm" lock type. You may need to run "podman system renumber" after you
change the lock type.
**namespace**=""
Default libpod namespace. If libpod is joined to a namespace, it will see
only containers and pods that were created in the same namespace, and will
create new containers and pods in that namespace. The default namespace is "",
which corresponds to no namespace. When no namespace is set, all containers
and pods are visible.
**no_pivot_root**=false
Whether to use chroot instead of pivot_root in the runtime.
**num_locks**=2048
Number of locks available for containers and pods. Each created container or
pod consumes one lock. The default number available is 2048. If this is
changed, a lock renumbering must be performed, using the
`podman system renumber` command.
**runtime**="crun"
Default OCI specific runtime in runtimes that will be used by default. Must
refer to a member of the runtimes table.
**runtime_supports_json**=["crun", "runc"]
The list of the OCI runtimes that support `--format=json`.
**runtime_supports_nocgroups**=["crun"]
The list of OCI runtimes that support running containers without CGroups.
**static_dir**="/var/lib/containers/storage/libpod"
Directory for persistent libpod files (database, etc).
By default this will be configured relative to where containers/storage
stores containers.
**tmp_dir**="/var/run/libpod"
The path to a temporary directory to store per-boot container.
Must be a tmpfs (wiped after reboot).
**volume_path**="/var/lib/containers/storage/volumes"
Directory where named volumes will be created in using the default volume
driver.
By default this will be configured relative to where containers/storage store
containers. This convention is followed by the default volume driver, but may
not be by other drivers.
# FILES
Distributions often provide a `/usr/share/containers/containers.conf` file to
define default container configuration. Administrators can override fields in
this file by creating `/etc/containers/containers.conf` to specify their own
configuration. Rootless users can further override fields in the config by
creating a config file stored in the
`$HOME/.config/containers/containers.conf` file.
If the `CONTAINERS_CONF` path environment variable is set, just
this path will be used. This is primarily used for testing.
Fields specified in the containers.conf file override the default options, as
well as options in previously read containers.conf files.
# SEE ALSO
containers-storage.conf(5), containers-policy.json(5), containers-registries.conf(5)
[toml]: https://github.com/toml-lang/toml

View File

@ -1,221 +0,0 @@
% containers.conf(5) Container runtime tools configuration file
# NAME
containers.conf - The containers configuration file specifies all of the available configuration options and command-line flags for container runtime tools like Podman & Buildah, but in a TOML format that can be easily modified and versioned.
# DESCRIPTION
The containers configuration file specifies all of the available configuration options and command-line flags for container runtime tools like Podman & Buildah, but in a TOML format that can be easily modified and versioned.
# FORMAT
The [TOML format][toml] is used as the encoding of the configuration file. Every option is nested under its table. No bare options are used. The format of TOML can be simplified to:
[table1]
option = value
[table2]
option = value
[table3]
option = value
[table3.subtable1]
option = value
## CONTAINERS TABLE
The containers table contains settings pertaining to the OCI runtime that can configure and manage the OCI runtime.
**additional_devices**=[]
List of additional devices. Specified as "<device-on-host>:<device-on-container>:<permissions>", for example: "--additional-devices=/dev/sdc:/dev/xvdc:rwm".
**apparmor_profile**=""
Used to change the name of the default AppArmor profile of container engines. The default profile name is "container-default".
**cgroup_manager**="systemd"
The cgroup management implementation used for the runtime. Supports cgroupfs and systemd.
**default_capabilities**=[]
List of default capabilities for containers.
The default list is:
```
default_capabilities = [
"AUDIT_WRITE",
"CHOWN",
"DAC_OVERRIDE",
"FOWNER",
"FSETID",
"KILL",
"MKNOD",
"NET_BIND_SERVICE",
"NET_RAW",
"SETGID",
"SETPCAP",
"SETUID",
"SYS_CHROOT",
]
```
**default_sysctls**=[]
List of default sysctls.
**default_ulimits**=[]
A list of ulimits to be set in containers by default, specified as "<ulimit name>=<soft limit>:<hard limit>", for example:"nofile=1024:2048".
**env**=["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"]
Environment variable list for the container process, used for passing environment variables to the container.
**hooks_dir**=["/etc/containers/oci/hooks.d", ...]
Path to the OCI hooks directories for automatically executed hooks.
**http_proxy**=[]"`
The proxy environment variable list to apply to container process
**init**=false
Run an init inside the container that forwards signals and reaps processes.
**label**="true|false"
Indicates whether the containers should use label separation.
**log_size_max**=-1
Maximum size allowed for the container's log file. Negative numbers indicate that no size limit is imposed. If it is positive, it must be >= 8192 to match/exceed conmon's read buffer. The file is truncated and re-opened so the limit is never exceeded.
**pids_limit**=1024
Maximum number of processes allowed in a container. 0 indicates that no limit is imposed.
**seccomp_profile**="/usr/share/containers/seccomp.json"
Path to the seccomp.json profile which is used as the default seccomp profile for the runtime.
**shm_size**=64m
Size of `/dev/shm`. The format is `<number><unit>`. `number` must be greater than `0`. Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`(megabytes), or `g` (gigabytes). If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`.
**signature_policy_path**=""
The path to a signature policy to use for validating images. If left empty, the containers/image default signature policy will be used.
## NETWORK TABLE
The `network` table containers settings pertaining to the management of CNI plugins.
**cni_plugin_dirs**=["/opt/cni/bin/",]
List of paths to directories where CNI plugin binaries are located.
**default_network**="podman"
The network name of the default CNI network to attach pods to.
**network_config_dir**="/etc/cni/net.d/"
Path to the directory where CNI configuration files are located.
## LIBPOD TABLE
The`libpod` table contains configuration options used to set up a libpod runtime
**conmon_env_vars**=""
Environment variables to pass into Conmon
**conmon_path**=""
Paths to search for the conmon container manager binary. If the paths are empty or no valid path was found, then the `$PATH` environment variable will be used as the fallback.
The default list is
```
conmon_path=[
"/usr/libexec/podman/conmon",
"/usr/local/libexec/podman/conmon",
"/usr/local/lib/podman/conmon",
"/usr/bin/conmon",
"/usr/sbin/conmon",
"/usr/local/bin/conmon",
"/usr/local/sbin/conmon",
"/run/current-system/sw/bin/conmon",
]
```
**detach_keys**=""
Keys sequence used for detaching a container
**enable_port_reservation**=true
Determines whether libpod will reserve ports on the host when they are forwarded to containers. When enabled, when ports are forwarded to containers, they are held open by conmon as long as the container is running, ensuring that they cannot be reused by other
programs on the host. However, this can cause significant memory usage if
a container has many ports forwarded to it. Disabling this can save
memory.
**events_logfile_path**=""
Path to the file where the events log is stored. The default is
**events_logger**=""
Default method to use when logging events. Valid values are "file", "journald", and "none".
**image_default_transport**=""
Default transport method for pulling and pushing images
**infra_command**=""
Command to run the infra container
**infra_image** = ""
Infra (pause) container image name for pod infra containers. When running a pod, we
start a `pause` process in a container to hold open the namespaces associated with the
pod. This container and process, basically sleep/pause for the lifetime of the pod.
**init_path**=""
Path to the container-init binary, which forwards signals and reaps processes within containers. Note that the container-init binary will only be used when the `--init` for podman-create and podman-run is set.
**lock_type**=""
Specify the locking mechanism to use; valid values are "shm" and "file". Change the default only if you are sure of what you are doing, in general "file" is useful only on platforms where cgo is not available for using the faster "shm" lock type. You may need to run "podman system renumber" after you change the lock type.
**namespace**=""
Default libpod namespace. If libpod is joined to a namespace, it will see only containers and pods
that were created in the same namespace, and will create new containers and pods in that namespace.
The default namespace is "", which corresponds to no namespace. When no namespace is set, all
containers and pods are visible.
**network_cmd_path**=""
Path to the command binary to use for setting up a network. It is currently only used for setting up
a slirp4netns network. If "" is used then the binary is looked up using the $PATH environment variable.
**no_pivot_root**=""
Whether to use chroot instead of pivot_root in the runtime
**num_locks**=""
Number of locks available for containers and pods. Each created container or pod consumes one lock.
The default number available is 2048.
If this is changed, a lock renumbering must be performed, using the `podman system renumber` command.
**runtime**=""
Default OCI runtime to use if nothing is specified in **runtimes**
**runtimes**
For each OCI runtime, specify a list of paths to look for. The first one found is used. If the paths are empty or no valid path was found, then the `$PATH` environment variable will be used as the fallback.
**runtime_path**=[]
RuntimePath is the path to OCI runtime binary for launching containers. The first path pointing to a valid file will be used This is used only when there are no OCIRuntime/OCIRuntimes defined. It is used only to be backward compatible with older versions of Podman.
**runtime_supports_json**=[]"`
The list of the OCI runtimes that support `--format=json`.
**runtime_supports_nocgroups**=[]"
Theist of OCI runtimes that support running containers without CGroups.
**static_dir**=""
Directory for persistent libpod files (database, etc)
By default this will be configured relative to where containers/storage
stores containers
**tmp_dir**=""
The path to a temporary directory to store per-boot container
Must be a tmpfs (wiped after reboot)
**volume_path**=""
Directory where named volumes will be created in using the default volume driver.
By default this will be configured relative to where containers/storage stores containers.
This convention is followed by the default volume driver, but may not be by other drivers.
# FILES
Distributions often provide a `/usr/share/containers/containers.conf` file to
define default container configuration. Administrators can override this file
by creating `/etc/containers/containers.conf` to specify their own
configuration. Rootless users can fursther override the config by creating a config file stored in the `$HOME/.config/containers/containers.conf` file.
If the `CONTAINERS_CONF` path environment variable is set, just
this path will be used. This is primarily used for testing.
# SEE ALSO
containers-storage.conf(5), containers-policy.json(5), containers-registries.conf(5)
[toml]: https://github.com/toml-lang/toml

View File

@ -84,8 +84,8 @@ type ContainersConfig struct {
// DefaultUlimits specifies the default ulimits to apply to containers
DefaultUlimits []string `toml:"default_ulimits"`
// DNS set default DNS servers.
DNS string `toml:"default_ulimits"`
// DNSServers set default DNS servers.
DNSServers []string `toml:"dns_servers"`
// DNSOptions set default DNS options.
DNSOptions []string `toml:"dns_options"`
@ -110,7 +110,7 @@ type ContainersConfig struct {
HooksDir []string `toml:"hooks_dir"`
// HTTPProxy is the proxy environment variable list to apply to container process
HTTPProxy []string `toml:"http_proxy"`
HTTPProxy bool `toml:"http_proxy"`
// Init tells container runtimes whether to run init inside the
// container that forwards signals and reaps processes.
@ -134,8 +134,8 @@ type ContainersConfig struct {
// NetNS indicates how to create a network namespace for the container
NetNS string `toml:"netns"`
// NoHost tells container engine whether to create its own /etc/hosts
NoHost bool `toml:"no_host"`
// NoHosts tells container engine whether to create its own /etc/hosts
NoHosts bool `toml:"no_hosts"`
// PidsLimit is the number of processes each container is restricted to
// by the cgroup process number controller.
@ -237,12 +237,6 @@ type LibpodConfig struct {
// OCIRuntimes are the set of configured OCI runtimes (default is runc).
OCIRuntimes map[string][]string `toml:"runtimes"`
// RuntimePath is the path to OCI runtime binary for launching containers.
// The first path pointing to a valid file will be used This is used only
// when there are no OCIRuntime/OCIRuntimes defined. It is used only to be
// backward compatible with older versions of Podman.
RuntimePath []string `toml:"runtime_path"`
// RuntimeSupportsJSON is the list of the OCI runtimes that support
// --format=json.
RuntimeSupportsJSON []string `toml:"runtime_supports_json"`
@ -696,6 +690,24 @@ func (c *Config) FindConmon() (string, error) {
c.Libpod.ConmonPath)
}
// GetDefaultEnv returns the environment variables for the container.
// It will checn the HTTPProxy and HostEnv booleans and add the appropriate
// environment variables to the container.
func (c *Config) GetDefaultEnv() []string {
var env []string
if c.Containers.EnvHost {
env = append(env, os.Environ()...)
} else if c.Containers.HTTPProxy {
proxy := []string{"http_proxy", "https_proxy", "ftp_proxy", "no_proxy", "HTTP_PROXY", "HTTPS_PROXY", "FTP_PROXY", "NO_PROXY"}
for _, p := range proxy {
if val, ok := os.LookupEnv(p); ok {
env = append(env, fmt.Sprintf("%s=%s", p, val))
}
}
}
return append(env, c.Containers.Env...)
}
// Device parses device mapping string to a src, dest & permissions string
// Valid values for device looklike:
// '/dev/sdc"

View File

@ -4,6 +4,7 @@ import (
"io/ioutil"
"os"
"path"
"strings"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -373,6 +374,30 @@ var _ = Describe("Config", func() {
Expect(config.Libpod.OCIRuntimes["runc"]).To(Equal(OCIRuntimeMap["runc"]))
})
It("verify getDefaultEnv", func() {
envs := []string{
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
}
// When
config, err := NewConfig("")
// Then
Expect(err).To(BeNil())
Expect(config.GetDefaultEnv()).To(BeEquivalentTo(envs))
config.Containers.HTTPProxy = true
Expect(config.GetDefaultEnv()).To(BeEquivalentTo(envs))
os.Setenv("HTTP_PROXY", "localhost")
os.Setenv("FOO", "BAR")
newenvs := []string{"HTTP_PROXY=localhost"}
envs = append(newenvs, envs...)
Expect(config.GetDefaultEnv()).To(BeEquivalentTo(envs))
config.Containers.HTTPProxy = false
config.Containers.EnvHost = true
envString := strings.Join(config.GetDefaultEnv(), ",")
Expect(envString).To(ContainSubstring("FOO=BAR"))
Expect(envString).To(ContainSubstring("HTTP_PROXY=localhost"))
})
It("should success with valid user file path", func() {
// Given
// When

View File

@ -12,7 +12,7 @@
# 2. /etc/containers/containers.conf
# 3. $HOME/.config/containers/containers.conf (Rootless containers ONLY)
# Items specified in the latter containers.conf, if they exist, override the
# previous containers.conf # settings, or the default settings.
# previous containers.conf settings, or the default settings.
[containers]
@ -20,29 +20,35 @@
# "<device-on-host>:<device-on-container>:<permissions>", for example:
# "/dev/sdc:/dev/xvdc:rwm".
# If it is empty or commented out, only the default devices will be used
#
# additional_devices = []
# List of additional volumes. Specified as
# "<directory-on-host>:<derectory-in-container>:<options>", for example:
# "<directory-on-host>:<directory-in-container>:<options>", for example:
# "/db:/var/lib/db:ro".
# If it is empty or commented out, no volumes will be added
#
# additional_volumes = []
# Used to change the name of the default AppArmor profile of container engines.
#
# apparmor_profile = "container-default"
# Default way to to create a cgroup namespace for the container
# Options are:
# `private` Create private Cgroup Namespace for the container.
# `host` Share host Cgroup Namespace with the container.
# cgroupns="private"
#
# cgroupns = "private"
# Cgroup management implementation used for the runtime.
# Valid options “systemd” or “cgroupfs”
#
# cgroup_manager = "systemd"
# List of default capabilities for containers. If it is empty or commented out,
# the default capabilities defined in the container engine will be added.
#
# default_capabilities = [
# "AUDIT_WRITE",
# "CHOWN",
@ -59,9 +65,12 @@
# "SYS_CHROOT",
# ]
# List of default sysctls. If it is empty or commented out, only the sysctls
# defined in the container json file by the user/kube will be added.
# A list of sysctls to be set in containers by default,
# specified as "name=value",
# for example:"net.ipv4.ping_group_range = 0 1000".
#
# default_sysctls = [
# "net.ipv4.ping_group_range=0 1000",
# ]
# A list of ulimits to be set in containers by default, specified as
@ -71,68 +80,82 @@
# Any limit not specified here will be inherited from the process launching the
# container engine.
# Ulimits has limits for non privileged container engines.
#
# default_ulimits = [
# “nofile”=”1280:2560”,
# ]
# List of default DNS options to be added to /etc/resolv.conf inside of the container.
#
# dns_options = []
# List of default DNS search domains to be added to /etc/resolv.conf inside of the container.
#
# dns_searches = []
# Set default DNS servers.
# This option can be used to override the DNS configuration passed to the
# container. The special value “none” can be specified to disable creation of
# /etc/resolv.conf in the container.
# The /etc/resolv.conf file in the image will be used without changes.
# dns=
# Set default DNS options.
# dns_options = []
# Set default DNS search domains.
# dns_searches = []
#
# dns_servers = []
# Environment variable list for the conmon process; used for passing necessary
# environment variables to conmon or the runtime.
#
# env = [
# "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
# ]
# Pass all host environment variables into the container.
# env_host=false
#
# env_host = false
# Path to OCI hooks directories for automatically executed hooks.
#
# hooks_dir = [
# “/usr/share/containers/oci/hooks.d”,
# ]
# Run an init inside the container that forwards signals and reaps processes.
# init = false
# Container init binary
# init_path = "/usr/libexec/podman/catatonit"
# Default proxy environment variables passed into the container.
# The environment variables passed in include:
# http_proxy, https_proxy, ftp_proxy, no_proxy, and the upper case versions of
# these. This option is needed when host system uses a proxy but container
# should not use proxy. Proxy environment variables specified for the container
# in any other way will override the values passed from the host.
# http_proxy=true
#
# http_proxy = true
# Run an init inside the container that forwards signals and reaps processes.
#
# init = false
# Container init binary, if init=true, this is the init binary to be used for containers.
#
# init_path = "/usr/libexec/podman/catatonit"
# Default way to to create an IPC namespace (POSIX SysV IPC) for the container
# Options are:
# `private` Create private IPC Namespace for the container.
# `host` Share host IPC Namespace with the container.
# ipcns="private"
#
# ipcns = "private"
# container engines use container separation using MAC(SELinux) labeling.
# Flag is ignored on label disabled systems.
#
# label = true
# Logging driver for the container. Available options: k8s-file and journald
# log_driver="k8s-file"
# Logging driver for the container. Available options: k8s-file and journald.
#
# log_driver = "k8s-file"
# Maximum size allowed for the container log file. Negative numbers indicate
# that no size limit is imposed. If positive, it must be >= 8192 to match or
# exceed conmon's read buffer. The file is truncated and re-opened so the
# limit is never exceeded.
#
# log_size_max = -1
# Default way to to create a Network namespace for the container
@ -140,72 +163,80 @@
# `private` Create private Network Namespace for the container.
# `host` Share host Network Namespace with the container.
# `none` Containers do not use the network
# netns="private"
#
# netns = "private"
# Create /etc/hosts for the container. By default, container engines manage
# /etc/hosts, automatically adding the container's own IP address.
# no_host="false"
#
# no_hosts = false
# Maximum number of processes allowed in a container.
#
# pids_limit = 2048
# Default way to to create a PID namespace for the container
# Options are:
# `private` Create private PID Namespace for the container.
# `host` Share host PID Namespace with the container.
# pidns="private"
#
# pidns = "private"
# Path to the seccomp.json profile which is used as the default seccomp profile
# for the runtime.
#
# seccomp_profile = "/usr/share/containers/seccomp.json"
# Size of /dev/shm. Specified as <number><unit>.
# Unit is optional, values:
# b (bytes), k (kilobytes), m (megabytes), or g (gigabytes).
# If the unit is omitted, the system uses bytes.
#
# shm_size = "65536k"
# Default way to to create a UTS namespace for the container
# Options are:
# `private` Create private UTS Namespace for the container.
# `host` Share host UTS Namespace with the container.
# utsns="private"
#
# utsns = "private"
# Default way to to create a User namespace for the container
# Options are:
# `auto` Create unique User Namespace for the container.
# `host` Share host User Namespace with the container.
# userns="host"
#
# userns = "host"
# Number of UIDs to allocate for the automatic container creation.
# UIDs are allocated from the “container” UIDs listed in
# /etc/subuid & /etc/subgid
#
# userns_size=65536
# The network table containers settings pertaining to the management of
# The network table contains settings pertaining to the management of
# CNI plugins.
[network]
# Path to directory where CNI plugin binaries are located.
#
# cni_plugin_dirs = ["/usr/libexec/cni"]
# Path to the directory where CNI configuration files are located.
#
# network_config_dir = "/etc/cni/net.d/"
# User-mode networking for unprivileged network namespaces executable
# usermode_tool=”/usr/bin/slirp4netns”
[libpod]
# Default transport method for pulling and pushing for images
# image_default_transport = "docker://"
# Environment variables to pass into conmon
#
# conmon_env_vars = [
# "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# ]
# Paths to look for the conmon container manager binary
#
# conmon_path = [
# "/usr/libexec/podman/conmon",
# "/usr/local/libexec/podman/conmon",
@ -216,32 +247,12 @@
# "/usr/local/sbin/conmon"
# ]
# Directory for persistent libpod files (database, etc)
# By default, this will be configured relative to where the containers/storage
# stores containers
# Uncomment to change location from this default
# static_dir = "/var/lib/containers/storage/libpod"
# Directory for temporary files. Must be tmpfs (wiped after reboot)
# tmp_dir = "/var/run/libpod"
# Whether to use chroot instead of pivot_root in the runtime
# no_pivot_root = false
# Default libpod namespace
# If libpod is joined to a namespace, it will see only containers and pods
# that were created in the same namespace, and will create new containers and
# pods in that namespace.
# The default namespace is "", which corresponds to no namespace. When no
# namespace is set, all containers and pods are visible.
# namespace = ""
# Default infra (pause) image name for pod infra containers
# infra_image = "k8s.gcr.io/pause:3.1"
# Default command to run the infra container
# infra_command = "/pause"
# Specify the keys sequence used to detach a container.
# Format is a single character [a-Z] or a comma separated sequence of
# `ctrl-<value>`, where `<value>` is one of:
# `a-z`, `@`, `^`, `[`, `\`, `]`, `^` or `_`
#
# detach_keys = "ctrl-p,ctrl-q"
# Determines whether libpod will reserve ports on the host when they are
# forwarded to containers. When enabled, when ports are forwarded to containers,
@ -249,34 +260,81 @@
# they cannot be reused by other programs on the host. However, this can cause
# significant memory usage if a container has many ports forwarded to it.
# Disabling this can save memory.
#
# enable_port_reservation = true
# Selects which logging mechanism to use for container engine events.
# Valid values are `journald`, `file` and `none`.
#
# events_logger = "journald"
# Default transport method for pulling and pushing for images
#
# image_default_transport = "docker://"
# Default command to run the infra container
#
# infra_command = "/pause"
# Infra (pause) container image name for pod infra containers. When running a
# pod, we start a `pause` process in a container to hold open the namespaces
# associated with the pod. This container does nothing other then sleep,
# reserving the pods resources for the lifetime of the pod.
#
# infra_image = "k8s.gcr.io/pause:3.1"
# Specify the locking mechanism to use; valid values are "shm" and "file".
# Change the default only if you are sure of what you are doing, in general
# "file" is useful only on platforms where cgo is not available for using the
# faster "shm" lock type. You may need to run "podman system renumber" after
# you change the lock type.
#
# lock_type** = "shm"
# Default libpod namespace
# If libpod is joined to a namespace, it will see only containers and pods
# that were created in the same namespace, and will create new containers and
# pods in that namespace.
# The default namespace is "", which corresponds to no namespace. When no
# namespace is set, all containers and pods are visible.
#
# namespace = ""
# Whether to use chroot instead of pivot_root in the runtime
#
# no_pivot_root = false
# Number of locks available for containers and pods.
# If this is changed, a lock renumber must be performed (e.g. with the
# 'podman system renumber' command).
#
# num_locks = 2048
# Directory for persistent libpod files (database, etc)
# By default, this will be configured relative to where the containers/storage
# stores containers
# Uncomment to change location from this default
#
# static_dir = "/var/lib/containers/storage/libpod"
# Directory for temporary files. Must be tmpfs (wiped after reboot)
#
# tmp_dir = "/var/run/libpod"
# Directory for libpod named volumes.
# By default, this will be configured relative to where containers/storage
# stores containers.
# Uncomment to change location from this default.
#
# volume_path = "/var/lib/containers/storage/volumes"
# Selects which logging mechanism to use for container engine events.
# Valid values are `journald` or `file`.
# events_logger = "file"
# Specify the keys sequence used to detach a container.
# Format is a single character [a-Z] or a comma separated sequence of
# `ctrl-<value>`, where `<value>` is one of:
# `a-z`, `@`, `^`, `[`, `\`, `]`, `^` or `_`
# detach_keys = "ctrl-p,ctrl-q"
# Default OCI runtime
#
# runtime = "runc"
# List of the OCI runtimes that support --format=json. When json is supported
# libpod will use it for reporting nicer errors.
#
# runtime_supports_json = ["crun", "runc"]
# Paths to look for a valid OCI runtime (runc, runv, etc)

View File

@ -143,7 +143,7 @@ func DefaultConfig() (*Config, error) {
DefaultCapabilities: DefaultCapabilities,
DefaultSysctls: []string{},
DefaultUlimits: []string{},
DNS: "",
DNSServers: []string{},
DNSOptions: []string{},
DNSSearches: []string{},
EnableLabeling: selinuxEnabled(),
@ -152,14 +152,14 @@ func DefaultConfig() (*Config, error) {
},
EnvHost: false,
HooksDir: DefaultHooksDirs,
HTTPProxy: []string{},
HTTPProxy: false,
Init: false,
InitPath: "",
IPCNS: "private",
LogDriver: DefaultLogDriver,
LogSizeMax: DefaultLogSizeMax,
NetNS: "private",
NoHost: false,
NoHosts: false,
PidsLimit: DefaultPidsLimit,
PidNS: "private",
SeccompProfile: SeccompDefaultPath,

View File

@ -68,8 +68,7 @@ hooks_dir = [
init = false
# proxy environment variables are passed into the container
http_proxy = [
]
http_proxy = false
# whether the container tool will support container labeling.
label = true