moby--moby/integration/container
Sebastiaan van Stijn a826ca3aef
daemon.WithCommonOptions() fix detection of user-namespaces
Commit dae652e2e5 added support for non-privileged
containers to use ICMP_PROTO (used for `ping`). This option cannot be set for
containers that have user-namespaces enabled.

However, the detection looks to be incorrect; HostConfig.UsernsMode was added
in 6993e891d1 / ee2183881b,
and the property only has meaning if the daemon is running with user namespaces
enabled. In other situations, the property has no meaning.
As a result of the above, the sysctl would only be set for containers running
with UsernsMode=host on a daemon running with user-namespaces enabled.

This patch adds a check if the daemon has user-namespaces enabled (RemappedRoot
having a non-empty value), or if the daemon is running inside a user namespace
(e.g. rootless mode) to fix the detection.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-30 19:48:29 +02:00
..
checkpoint_test.go unused: ignore false positives 2021-06-10 13:03:32 +02:00
container_test.go integration: remove deprecated endpoint test 2021-07-26 22:42:21 +02:00
copy_test.go refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
create_test.go Don't set default platform on container create 2020-10-20 20:17:23 +00:00
daemon_linux_test.go refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
daemon_test.go On startup, actually shutdown the container. 2020-04-13 14:20:12 -07:00
diff_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
exec_test.go refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
export_test.go Using test names instead of hardcoded ones in integration/container directory 2020-05-18 16:37:04 +01:00
health_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
inspect_test.go Using test names instead of hardcoded ones in integration/container directory 2020-05-18 16:37:04 +01:00
ipcmode_linux_test.go Merge pull request #40084 from thaJeztah/hostconfig_const_cleanup 2021-08-28 00:21:31 +09:00
kill_test.go TestInspectOomKilledTrue: skip on cgroup v2 2021-01-29 16:05:15 +09:00
links_linux_test.go refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
logs_test.go refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
main_test.go testutil: make testing packages public 2019-09-11 07:47:23 -05:00
mounts_linux_test.go Use specific APIs for shared mount-point behaviour 2020-11-10 20:00:48 +11:00
nat_test.go refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
pause_test.go Prepare tests for Windows containerd support 2021-04-22 10:50:00 +03:00
pidmode_linux_test.go rootless: support --pid=host 2021-02-01 14:55:18 +09:00
ps_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
remove_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
rename_test.go Prepare tests for Windows containerd support 2021-04-22 10:50:00 +03:00
resize_test.go Prepare tests for Windows containerd support 2021-04-22 10:50:00 +03:00
restart_test.go Merge pull request #40725 from cpuguy83/check_img_platform 2020-05-21 11:33:27 -07:00
run_cgroupns_linux_test.go integration: port TestRunModePIDHost from CLI test to API test 2021-02-01 14:54:07 +09:00
run_linux_test.go daemon.WithCommonOptions() fix detection of user-namespaces 2021-08-30 19:48:29 +02:00
stats_test.go Merge pull request #40478 from cpuguy83/dont-prime-the-stats 2020-04-16 20:57:06 +02:00
stop_linux_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
stop_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
stop_windows_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
update_linux_test.go test-integration: support cgroup2 2020-06-22 14:17:45 +09:00
update_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
wait_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00