Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions common/docs/containers.conf.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,17 @@ run on the machine.
A list of default pasta options that should be used running pasta.
It accepts the pasta cli options, see pasta(1) for the full list of options.

**default_host_ips**=[]

The default host IPs to bind published container ports to when no host IP
is explicitly specified in the `-p` flag (e.g., `-p 8000:8000`). If empty, the default
behavior is to bind to all network interfaces (`0.0.0.0`). If multiple IPs are specified,
separate port mapping for each of the specified IP would be created. For instance, setting
this to `["127.0.0.1", "::1"]` and port specified as `-p 8080:80` will result into two
port mappings in podman--`127.0.0.1:8080:80` and `[::1]:8080:80`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here with --

Note that explicitly specifying a host IP in the `-p` flag (e.g., `-p 192.168.1.10:8000:8000`)
will always override this default.

## ENGINE TABLE
The `engine` table contains configuration options used to set up container engines such as Podman and Buildah.

Expand Down
7 changes: 7 additions & 0 deletions common/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,13 @@ type NetworkConfig struct {
// PastaOptions contains a default list of pasta(1) options that should
// be used when running pasta.
PastaOptions attributedstring.Slice `toml:"pasta_options,omitempty"`

// DefaultHostIPs is the default host IPs to bind published container ports
// to when no host IP is explicitly specified in the -p flag (e.g., -p 80:80).
// If empty, the default behavior is to bind to all interfaces (0.0.0.0).
// If multiple IPs are specified, separate port mapping for each of the specified
// IP would be created.
DefaultHostIPs []string `toml:"default_host_ips,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use attributedstring.Slice like other array to support appending accordingly

Also not trying to bikeshed but I wonder if default_host_ips is the best name here? Should it be default_publish_ips or default_port_bind_ips? HostIP IMO could be assumed to be something else unrelated to port mappings, i.e. we already have host_containers_internal_ip for example.

}

type SubnetPool struct {
Expand Down
10 changes: 10 additions & 0 deletions common/pkg/config/containers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,16 @@ default_sysctls = [
#
#pasta_options = []

# The default host IPs to bind published container ports to when no host IP
# is explicitly specified in the -p flag (e.g., -p 8000:8000). If empty, the default
# behavior is to bind to all network interfaces (0.0.0.0). If multiple IPs are specified,
# separate port mapping for each of the specified IP would be created. For instance, setting
# this to ["127.0.0.1", "::1"] and port specified as -p 8080:80 will result into two
# port mappings in podman--127.0.0.1:8080:80 and [::1]:8080:80.
# Note that explicitly specifying a host IP via -p will always override this.
#
#default_host_ips = []

[engine]
# Index to the active service
#
Expand Down
10 changes: 10 additions & 0 deletions common/pkg/config/containers.conf-freebsd
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,16 @@ default_sysctls = [
#
#network_config_dir = "/usr/local/etc/cni/net.d/"

# The default host IPs to bind published container ports to when no host IP
# is explicitly specified in the -p flag (e.g., -p 8000:8000). If empty, the default
# behavior is to bind to all network interfaces (0.0.0.0). If multiple IPs are specified,
# separate port mapping for each of the specified IP would be created. For instance, setting
# this to ["127.0.0.1", "::1"] and port specified as -p 8080:80 will result into two
# port mappings in podman--127.0.0.1:8080:80 and [::1]:8080:80.
# Note that explicitly specifying a host IP via -p will always override this.
#
#default_host_ips = []

[engine]
# Index to the active service
#
Expand Down
Loading