mounts_linux_test.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. package container // import "github.com/docker/docker/integration/container"
  2. import (
  3. "fmt"
  4. "os"
  5. "path/filepath"
  6. "syscall"
  7. "testing"
  8. "time"
  9. "github.com/docker/docker/api"
  10. containertypes "github.com/docker/docker/api/types/container"
  11. mounttypes "github.com/docker/docker/api/types/mount"
  12. "github.com/docker/docker/api/types/network"
  13. "github.com/docker/docker/api/types/versions"
  14. "github.com/docker/docker/client"
  15. "github.com/docker/docker/integration/internal/container"
  16. "github.com/docker/docker/pkg/parsers/kernel"
  17. "github.com/docker/docker/testutil"
  18. "github.com/moby/sys/mount"
  19. "github.com/moby/sys/mountinfo"
  20. "gotest.tools/v3/assert"
  21. is "gotest.tools/v3/assert/cmp"
  22. "gotest.tools/v3/fs"
  23. "gotest.tools/v3/poll"
  24. "gotest.tools/v3/skip"
  25. )
  26. func TestContainerNetworkMountsNoChown(t *testing.T) {
  27. // chown only applies to Linux bind mounted volumes; must be same host to verify
  28. skip.If(t, testEnv.IsRemoteDaemon)
  29. ctx := setupTest(t)
  30. tmpDir := fs.NewDir(t, "network-file-mounts", fs.WithMode(0o755), fs.WithFile("nwfile", "network file bind mount", fs.WithMode(0o644)))
  31. defer tmpDir.Remove()
  32. tmpNWFileMount := tmpDir.Join("nwfile")
  33. config := containertypes.Config{
  34. Image: "busybox",
  35. }
  36. hostConfig := containertypes.HostConfig{
  37. Mounts: []mounttypes.Mount{
  38. {
  39. Type: "bind",
  40. Source: tmpNWFileMount,
  41. Target: "/etc/resolv.conf",
  42. },
  43. {
  44. Type: "bind",
  45. Source: tmpNWFileMount,
  46. Target: "/etc/hostname",
  47. },
  48. {
  49. Type: "bind",
  50. Source: tmpNWFileMount,
  51. Target: "/etc/hosts",
  52. },
  53. },
  54. }
  55. cli, err := client.NewClientWithOpts(client.FromEnv)
  56. assert.NilError(t, err)
  57. defer cli.Close()
  58. ctrCreate, err := cli.ContainerCreate(ctx, &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
  59. assert.NilError(t, err)
  60. // container will exit immediately because of no tty, but we only need the start sequence to test the condition
  61. err = cli.ContainerStart(ctx, ctrCreate.ID, containertypes.StartOptions{})
  62. assert.NilError(t, err)
  63. // Check that host-located bind mount network file did not change ownership when the container was started
  64. // Note: If the user specifies a mountpath from the host, we should not be
  65. // attempting to chown files outside the daemon's metadata directory
  66. // (represented by `daemon.repository` at init time).
  67. // This forces users who want to use user namespaces to handle the
  68. // ownership needs of any external files mounted as network files
  69. // (/etc/resolv.conf, /etc/hosts, /etc/hostname) separately from the
  70. // daemon. In all other volume/bind mount situations we have taken this
  71. // same line--we don't chown host file content.
  72. // See GitHub PR 34224 for details.
  73. info, err := os.Stat(tmpNWFileMount)
  74. assert.NilError(t, err)
  75. fi := info.Sys().(*syscall.Stat_t)
  76. assert.Check(t, is.Equal(fi.Uid, uint32(0)), "bind mounted network file should not change ownership from root")
  77. }
  78. func TestMountDaemonRoot(t *testing.T) {
  79. skip.If(t, testEnv.IsRemoteDaemon)
  80. ctx := setupTest(t)
  81. apiClient := testEnv.APIClient()
  82. info, err := apiClient.Info(ctx)
  83. if err != nil {
  84. t.Fatal(err)
  85. }
  86. for _, test := range []struct {
  87. desc string
  88. propagation mounttypes.Propagation
  89. expected mounttypes.Propagation
  90. }{
  91. {
  92. desc: "default",
  93. propagation: "",
  94. expected: mounttypes.PropagationRSlave,
  95. },
  96. {
  97. desc: "private",
  98. propagation: mounttypes.PropagationPrivate,
  99. },
  100. {
  101. desc: "rprivate",
  102. propagation: mounttypes.PropagationRPrivate,
  103. },
  104. {
  105. desc: "slave",
  106. propagation: mounttypes.PropagationSlave,
  107. },
  108. {
  109. desc: "rslave",
  110. propagation: mounttypes.PropagationRSlave,
  111. expected: mounttypes.PropagationRSlave,
  112. },
  113. {
  114. desc: "shared",
  115. propagation: mounttypes.PropagationShared,
  116. },
  117. {
  118. desc: "rshared",
  119. propagation: mounttypes.PropagationRShared,
  120. expected: mounttypes.PropagationRShared,
  121. },
  122. } {
  123. t.Run(test.desc, func(t *testing.T) {
  124. test := test
  125. t.Parallel()
  126. ctx := testutil.StartSpan(ctx, t)
  127. propagationSpec := fmt.Sprintf(":%s", test.propagation)
  128. if test.propagation == "" {
  129. propagationSpec = ""
  130. }
  131. bindSpecRoot := info.DockerRootDir + ":" + "/foo" + propagationSpec
  132. bindSpecSub := filepath.Join(info.DockerRootDir, "containers") + ":/foo" + propagationSpec
  133. for name, hc := range map[string]*containertypes.HostConfig{
  134. "bind root": {Binds: []string{bindSpecRoot}},
  135. "bind subpath": {Binds: []string{bindSpecSub}},
  136. "mount root": {
  137. Mounts: []mounttypes.Mount{
  138. {
  139. Type: mounttypes.TypeBind,
  140. Source: info.DockerRootDir,
  141. Target: "/foo",
  142. BindOptions: &mounttypes.BindOptions{Propagation: test.propagation},
  143. },
  144. },
  145. },
  146. "mount subpath": {
  147. Mounts: []mounttypes.Mount{
  148. {
  149. Type: mounttypes.TypeBind,
  150. Source: filepath.Join(info.DockerRootDir, "containers"),
  151. Target: "/foo",
  152. BindOptions: &mounttypes.BindOptions{Propagation: test.propagation},
  153. },
  154. },
  155. },
  156. } {
  157. t.Run(name, func(t *testing.T) {
  158. hc := hc
  159. t.Parallel()
  160. ctx := testutil.StartSpan(ctx, t)
  161. c, err := apiClient.ContainerCreate(ctx, &containertypes.Config{
  162. Image: "busybox",
  163. Cmd: []string{"true"},
  164. }, hc, nil, nil, "")
  165. if err != nil {
  166. if test.expected != "" {
  167. t.Fatal(err)
  168. }
  169. // expected an error, so this is ok and should not continue
  170. return
  171. }
  172. if test.expected == "" {
  173. t.Fatal("expected create to fail")
  174. }
  175. defer func() {
  176. if err := apiClient.ContainerRemove(ctx, c.ID, containertypes.RemoveOptions{Force: true}); err != nil {
  177. panic(err)
  178. }
  179. }()
  180. inspect, err := apiClient.ContainerInspect(ctx, c.ID)
  181. if err != nil {
  182. t.Fatal(err)
  183. }
  184. if len(inspect.Mounts) != 1 {
  185. t.Fatalf("unexpected number of mounts: %+v", inspect.Mounts)
  186. }
  187. m := inspect.Mounts[0]
  188. if m.Propagation != test.expected {
  189. t.Fatalf("got unexpected propagation mode, expected %q, got: %v", test.expected, m.Propagation)
  190. }
  191. })
  192. }
  193. })
  194. }
  195. }
  196. func TestContainerBindMountNonRecursive(t *testing.T) {
  197. skip.If(t, testEnv.IsRemoteDaemon)
  198. skip.If(t, testEnv.IsRootless, "cannot be tested because RootlessKit executes the daemon in private mount namespace (https://github.com/rootless-containers/rootlesskit/issues/97)")
  199. ctx := setupTest(t)
  200. tmpDir1 := fs.NewDir(t, "tmpdir1", fs.WithMode(0o755),
  201. fs.WithDir("mnt", fs.WithMode(0o755)))
  202. defer tmpDir1.Remove()
  203. tmpDir1Mnt := filepath.Join(tmpDir1.Path(), "mnt")
  204. tmpDir2 := fs.NewDir(t, "tmpdir2", fs.WithMode(0o755),
  205. fs.WithFile("file", "should not be visible when NonRecursive", fs.WithMode(0o644)))
  206. defer tmpDir2.Remove()
  207. err := mount.Mount(tmpDir2.Path(), tmpDir1Mnt, "none", "bind,ro")
  208. if err != nil {
  209. t.Fatal(err)
  210. }
  211. defer func() {
  212. if err := mount.Unmount(tmpDir1Mnt); err != nil {
  213. t.Fatal(err)
  214. }
  215. }()
  216. // implicit is recursive (NonRecursive: false)
  217. implicit := mounttypes.Mount{
  218. Type: "bind",
  219. Source: tmpDir1.Path(),
  220. Target: "/foo",
  221. ReadOnly: true,
  222. }
  223. recursive := implicit
  224. recursive.BindOptions = &mounttypes.BindOptions{
  225. NonRecursive: false,
  226. }
  227. recursiveVerifier := []string{"test", "-f", "/foo/mnt/file"}
  228. nonRecursive := implicit
  229. nonRecursive.BindOptions = &mounttypes.BindOptions{
  230. NonRecursive: true,
  231. }
  232. nonRecursiveVerifier := []string{"test", "!", "-f", "/foo/mnt/file"}
  233. apiClient := testEnv.APIClient()
  234. containers := []string{
  235. container.Run(ctx, t, apiClient, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)),
  236. container.Run(ctx, t, apiClient, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)),
  237. container.Run(ctx, t, apiClient, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
  238. }
  239. for _, c := range containers {
  240. poll.WaitOn(t, container.IsSuccessful(ctx, apiClient, c), poll.WithDelay(100*time.Millisecond))
  241. }
  242. }
  243. func TestContainerVolumesMountedAsShared(t *testing.T) {
  244. // Volume propagation is linux only. Also it creates directories for
  245. // bind mounting, so needs to be same host.
  246. skip.If(t, testEnv.IsRemoteDaemon)
  247. skip.If(t, testEnv.IsUserNamespace)
  248. skip.If(t, testEnv.IsRootless, "cannot be tested because RootlessKit executes the daemon in private mount namespace (https://github.com/rootless-containers/rootlesskit/issues/97)")
  249. ctx := setupTest(t)
  250. // Prepare a source directory to bind mount
  251. tmpDir1 := fs.NewDir(t, "volume-source", fs.WithMode(0o755),
  252. fs.WithDir("mnt1", fs.WithMode(0o755)))
  253. defer tmpDir1.Remove()
  254. tmpDir1Mnt := filepath.Join(tmpDir1.Path(), "mnt1")
  255. // Convert this directory into a shared mount point so that we do
  256. // not rely on propagation properties of parent mount.
  257. if err := mount.MakePrivate(tmpDir1.Path()); err != nil {
  258. t.Fatal(err)
  259. }
  260. defer func() {
  261. if err := mount.Unmount(tmpDir1.Path()); err != nil {
  262. t.Fatal(err)
  263. }
  264. }()
  265. if err := mount.MakeShared(tmpDir1.Path()); err != nil {
  266. t.Fatal(err)
  267. }
  268. sharedMount := mounttypes.Mount{
  269. Type: mounttypes.TypeBind,
  270. Source: tmpDir1.Path(),
  271. Target: "/volume-dest",
  272. BindOptions: &mounttypes.BindOptions{
  273. Propagation: mounttypes.PropagationShared,
  274. },
  275. }
  276. bindMountCmd := []string{"mount", "--bind", "/volume-dest/mnt1", "/volume-dest/mnt1"}
  277. apiClient := testEnv.APIClient()
  278. containerID := container.Run(ctx, t, apiClient, container.WithPrivileged(true), container.WithMount(sharedMount), container.WithCmd(bindMountCmd...))
  279. poll.WaitOn(t, container.IsSuccessful(ctx, apiClient, containerID), poll.WithDelay(100*time.Millisecond))
  280. // Make sure a bind mount under a shared volume propagated to host.
  281. if mounted, _ := mountinfo.Mounted(tmpDir1Mnt); !mounted {
  282. t.Fatalf("Bind mount under shared volume did not propagate to host")
  283. }
  284. mount.Unmount(tmpDir1Mnt)
  285. }
  286. func TestContainerVolumesMountedAsSlave(t *testing.T) {
  287. // Volume propagation is linux only. Also it creates directories for
  288. // bind mounting, so needs to be same host.
  289. skip.If(t, testEnv.IsRemoteDaemon)
  290. skip.If(t, testEnv.IsUserNamespace)
  291. skip.If(t, testEnv.IsRootless, "cannot be tested because RootlessKit executes the daemon in private mount namespace (https://github.com/rootless-containers/rootlesskit/issues/97)")
  292. ctx := testutil.StartSpan(baseContext, t)
  293. // Prepare a source directory to bind mount
  294. tmpDir1 := fs.NewDir(t, "volume-source", fs.WithMode(0o755),
  295. fs.WithDir("mnt1", fs.WithMode(0o755)))
  296. defer tmpDir1.Remove()
  297. tmpDir1Mnt := filepath.Join(tmpDir1.Path(), "mnt1")
  298. // Prepare a source directory with file in it. We will bind mount this
  299. // directory and see if file shows up.
  300. tmpDir2 := fs.NewDir(t, "volume-source2", fs.WithMode(0o755),
  301. fs.WithFile("slave-testfile", "Test", fs.WithMode(0o644)))
  302. defer tmpDir2.Remove()
  303. // Convert this directory into a shared mount point so that we do
  304. // not rely on propagation properties of parent mount.
  305. if err := mount.MakePrivate(tmpDir1.Path()); err != nil {
  306. t.Fatal(err)
  307. }
  308. defer func() {
  309. if err := mount.Unmount(tmpDir1.Path()); err != nil {
  310. t.Fatal(err)
  311. }
  312. }()
  313. if err := mount.MakeShared(tmpDir1.Path()); err != nil {
  314. t.Fatal(err)
  315. }
  316. slaveMount := mounttypes.Mount{
  317. Type: mounttypes.TypeBind,
  318. Source: tmpDir1.Path(),
  319. Target: "/volume-dest",
  320. BindOptions: &mounttypes.BindOptions{
  321. Propagation: mounttypes.PropagationSlave,
  322. },
  323. }
  324. topCmd := []string{"top"}
  325. apiClient := testEnv.APIClient()
  326. containerID := container.Run(ctx, t, apiClient, container.WithTty(true), container.WithMount(slaveMount), container.WithCmd(topCmd...))
  327. // Bind mount tmpDir2/ onto tmpDir1/mnt1. If mount propagates inside
  328. // container then contents of tmpDir2/slave-testfile should become
  329. // visible at "/volume-dest/mnt1/slave-testfile"
  330. if err := mount.Mount(tmpDir2.Path(), tmpDir1Mnt, "none", "bind"); err != nil {
  331. t.Fatal(err)
  332. }
  333. defer func() {
  334. if err := mount.Unmount(tmpDir1Mnt); err != nil {
  335. t.Fatal(err)
  336. }
  337. }()
  338. mountCmd := []string{"cat", "/volume-dest/mnt1/slave-testfile"}
  339. if result, err := container.Exec(ctx, apiClient, containerID, mountCmd); err == nil {
  340. if result.Stdout() != "Test" {
  341. t.Fatalf("Bind mount under slave volume did not propagate to container")
  342. }
  343. } else {
  344. t.Fatal(err)
  345. }
  346. }
  347. // Regression test for #38995 and #43390.
  348. func TestContainerCopyLeaksMounts(t *testing.T) {
  349. ctx := setupTest(t)
  350. bindMount := mounttypes.Mount{
  351. Type: mounttypes.TypeBind,
  352. Source: "/var",
  353. Target: "/hostvar",
  354. BindOptions: &mounttypes.BindOptions{
  355. Propagation: mounttypes.PropagationRSlave,
  356. },
  357. }
  358. apiClient := testEnv.APIClient()
  359. cid := container.Run(ctx, t, apiClient, container.WithMount(bindMount), container.WithCmd("sleep", "120s"))
  360. getMounts := func() string {
  361. t.Helper()
  362. res, err := container.Exec(ctx, apiClient, cid, []string{"cat", "/proc/self/mountinfo"})
  363. assert.NilError(t, err)
  364. assert.Equal(t, res.ExitCode, 0)
  365. return res.Stdout()
  366. }
  367. mountsBefore := getMounts()
  368. _, _, err := apiClient.CopyFromContainer(ctx, cid, "/etc/passwd")
  369. assert.NilError(t, err)
  370. mountsAfter := getMounts()
  371. assert.Equal(t, mountsBefore, mountsAfter)
  372. }
  373. func TestContainerBindMountReadOnlyDefault(t *testing.T) {
  374. skip.If(t, testEnv.IsRemoteDaemon)
  375. skip.If(t, !isRROSupported(), "requires recursive read-only mounts")
  376. ctx := setupTest(t)
  377. // The test will run a container with a simple readonly /dev bind mount (-v /dev:/dev:ro)
  378. // It will then check /proc/self/mountinfo for the mount type of /dev/shm (submount of /dev)
  379. // If /dev/shm is rw, that will mean that the read-only mounts are NOT recursive by default.
  380. const nonRecursive = " /dev/shm rw,"
  381. // If /dev/shm is ro, that will mean that the read-only mounts ARE recursive by default.
  382. const recursive = " /dev/shm ro,"
  383. for _, tc := range []struct {
  384. clientVersion string
  385. expectedOut string
  386. name string
  387. }{
  388. {clientVersion: "", expectedOut: recursive, name: "latest should be the same as 1.44"},
  389. {clientVersion: "1.44", expectedOut: recursive, name: "submount should be recursive by default on 1.44"},
  390. {clientVersion: "1.43", expectedOut: nonRecursive, name: "older than 1.44 should be non-recursive by default"},
  391. // TODO: Remove when MinSupportedAPIVersion >= 1.44
  392. {clientVersion: api.MinSupportedAPIVersion, expectedOut: nonRecursive, name: "minimum API should be non-recursive by default"},
  393. } {
  394. t.Run(tc.name, func(t *testing.T) {
  395. apiClient := testEnv.APIClient()
  396. minDaemonVersion := tc.clientVersion
  397. if minDaemonVersion == "" {
  398. minDaemonVersion = "1.44"
  399. }
  400. skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), minDaemonVersion), "requires API v"+minDaemonVersion)
  401. if tc.clientVersion != "" {
  402. c, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion(tc.clientVersion))
  403. assert.NilError(t, err, "failed to create client with version v%s", tc.clientVersion)
  404. apiClient = c
  405. }
  406. for _, tc2 := range []struct {
  407. subname string
  408. mountOpt func(*container.TestContainerConfig)
  409. }{
  410. {"mount", container.WithMount(mounttypes.Mount{
  411. Type: mounttypes.TypeBind,
  412. Source: "/dev",
  413. Target: "/dev",
  414. ReadOnly: true,
  415. })},
  416. {"bind mount", container.WithBindRaw("/dev:/dev:ro")},
  417. } {
  418. t.Run(tc2.subname, func(t *testing.T) {
  419. cid := container.Run(ctx, t, apiClient, tc2.mountOpt,
  420. container.WithCmd("sh", "-c", "grep /dev/shm /proc/self/mountinfo"),
  421. )
  422. out, err := container.Output(ctx, apiClient, cid)
  423. assert.NilError(t, err)
  424. assert.Check(t, is.Equal(out.Stderr, ""))
  425. // Output should be either:
  426. // 545 526 0:160 / /dev/shm ro,nosuid,nodev,noexec,relatime shared:90 - tmpfs shm rw,size=65536k
  427. // or
  428. // 545 526 0:160 / /dev/shm rw,nosuid,nodev,noexec,relatime shared:90 - tmpfs shm rw,size=65536k
  429. assert.Check(t, is.Contains(out.Stdout, tc.expectedOut))
  430. })
  431. }
  432. })
  433. }
  434. }
  435. func TestContainerBindMountRecursivelyReadOnly(t *testing.T) {
  436. skip.If(t, testEnv.IsRemoteDaemon)
  437. skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.44"), "requires API v1.44")
  438. ctx := setupTest(t)
  439. // 0o777 for allowing rootless containers to write to this directory
  440. tmpDir1 := fs.NewDir(t, "tmpdir1", fs.WithMode(0o777),
  441. fs.WithDir("mnt", fs.WithMode(0o777)))
  442. defer tmpDir1.Remove()
  443. tmpDir1Mnt := filepath.Join(tmpDir1.Path(), "mnt")
  444. tmpDir2 := fs.NewDir(t, "tmpdir2", fs.WithMode(0o777),
  445. fs.WithFile("file", "should not be writable when recursively read only", fs.WithMode(0o666)))
  446. defer tmpDir2.Remove()
  447. if err := mount.Mount(tmpDir2.Path(), tmpDir1Mnt, "none", "bind"); err != nil {
  448. t.Fatal(err)
  449. }
  450. defer func() {
  451. if err := mount.Unmount(tmpDir1Mnt); err != nil {
  452. t.Fatal(err)
  453. }
  454. }()
  455. rroSupported := isRROSupported()
  456. nonRecursiveVerifier := []string{`/bin/sh`, `-xc`, `touch /foo/mnt/file; [ $? = 0 ]`}
  457. forceRecursiveVerifier := []string{`/bin/sh`, `-xc`, `touch /foo/mnt/file; [ $? != 0 ]`}
  458. // ro (recursive if kernel >= 5.12)
  459. ro := mounttypes.Mount{
  460. Type: mounttypes.TypeBind,
  461. Source: tmpDir1.Path(),
  462. Target: "/foo",
  463. ReadOnly: true,
  464. BindOptions: &mounttypes.BindOptions{
  465. Propagation: mounttypes.PropagationRPrivate,
  466. },
  467. }
  468. roAsStr := ro.Source + ":" + ro.Target + ":ro,rprivate"
  469. roVerifier := nonRecursiveVerifier
  470. if rroSupported {
  471. roVerifier = forceRecursiveVerifier
  472. }
  473. // Non-recursive
  474. nonRecursive := ro
  475. nonRecursive.BindOptions = &mounttypes.BindOptions{
  476. ReadOnlyNonRecursive: true,
  477. Propagation: mounttypes.PropagationRPrivate,
  478. }
  479. // Force recursive
  480. forceRecursive := ro
  481. forceRecursive.BindOptions = &mounttypes.BindOptions{
  482. ReadOnlyForceRecursive: true,
  483. Propagation: mounttypes.PropagationRPrivate,
  484. }
  485. apiClient := testEnv.APIClient()
  486. containers := []string{
  487. container.Run(ctx, t, apiClient, container.WithMount(ro), container.WithCmd(roVerifier...)),
  488. container.Run(ctx, t, apiClient, container.WithBindRaw(roAsStr), container.WithCmd(roVerifier...)),
  489. container.Run(ctx, t, apiClient, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
  490. }
  491. if rroSupported {
  492. containers = append(containers,
  493. container.Run(ctx, t, apiClient, container.WithMount(forceRecursive), container.WithCmd(forceRecursiveVerifier...)),
  494. )
  495. }
  496. for _, c := range containers {
  497. poll.WaitOn(t, container.IsSuccessful(ctx, apiClient, c), poll.WithDelay(100*time.Millisecond))
  498. }
  499. }
  500. func isRROSupported() bool {
  501. return kernel.CheckKernelVersion(5, 12, 0)
  502. }