Signed-off-by: Antonio Murdaca <runcom@redhat.com>
| ... | ... |
@@ -5,6 +5,7 @@ import ( |
| 5 | 5 |
"io" |
| 6 | 6 |
"os" |
| 7 | 7 |
"path/filepath" |
| 8 |
+ "sort" |
|
| 8 | 9 |
"strconv" |
| 9 | 10 |
"strings" |
| 10 | 11 |
|
| ... | ... |
@@ -635,13 +636,14 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e |
| 635 | 635 |
return nil, err |
| 636 | 636 |
} |
| 637 | 637 |
|
| 638 |
- mounts, err := daemon.setupMounts(c) |
|
| 638 |
+ ms, err := daemon.setupMounts(c) |
|
| 639 | 639 |
if err != nil {
|
| 640 | 640 |
return nil, err |
| 641 | 641 |
} |
| 642 |
- mounts = append(mounts, c.IpcMounts()...) |
|
| 643 |
- mounts = append(mounts, c.TmpfsMounts()...) |
|
| 644 |
- if err := setMounts(daemon, &s, c, mounts); err != nil {
|
|
| 642 |
+ ms = append(ms, c.IpcMounts()...) |
|
| 643 |
+ ms = append(ms, c.TmpfsMounts()...) |
|
| 644 |
+ sort.Sort(mounts(ms)) |
|
| 645 |
+ if err := setMounts(daemon, &s, c, ms); err != nil {
|
|
| 645 | 646 |
return nil, fmt.Errorf("linux mounts: %v", err)
|
| 646 | 647 |
} |
| 647 | 648 |
|
| ... | ... |
@@ -746,6 +746,14 @@ func (s *DockerSuite) TestRunWithShmSize(c *check.C) {
|
| 746 | 746 |
c.Assert(shmSize, check.Equals, "1073741824") |
| 747 | 747 |
} |
| 748 | 748 |
|
| 749 |
+func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *check.C) {
|
|
| 750 |
+ tmpFile, err := ioutil.TempFile("", "test")
|
|
| 751 |
+ c.Assert(err, check.IsNil) |
|
| 752 |
+ defer tmpFile.Close() |
|
| 753 |
+ out, _ := dockerCmd(c, "run", "--tmpfs", "/run", "-v", tmpFile.Name()+":/run/test", "busybox", "ls", "/run") |
|
| 754 |
+ c.Assert(out, checker.Contains, "test") |
|
| 755 |
+} |
|
| 756 |
+ |
|
| 749 | 757 |
func (s *DockerSuite) TestRunTmpfsMounts(c *check.C) {
|
| 750 | 758 |
// TODO Windows (Post TP5): This test cannot run on a Windows daemon as |
| 751 | 759 |
// Windows does not support tmpfs mounts. |
| ... | ... |
@@ -839,10 +847,8 @@ func (s *DockerSuite) TestRunSeccompProfileDenyChmod(c *check.C) {
|
| 839 | 839 |
] |
| 840 | 840 |
}` |
| 841 | 841 |
tmpFile, err := ioutil.TempFile("", "profile.json")
|
| 842 |
+ c.Assert(err, check.IsNil) |
|
| 842 | 843 |
defer tmpFile.Close() |
| 843 |
- if err != nil {
|
|
| 844 |
- c.Fatal(err) |
|
| 845 |
- } |
|
| 846 | 844 |
|
| 847 | 845 |
if _, err := tmpFile.Write([]byte(jsonData)); err != nil {
|
| 848 | 846 |
c.Fatal(err) |