Remove tar copy-up for tmpfs mounts
| ... | ... |
@@ -437,7 +437,6 @@ func (d *Driver) setupMounts(container *configs.Config, c *execdriver.Command) e |
| 437 | 437 |
flags = syscall.MS_NOEXEC | syscall.MS_NOSUID | syscall.MS_NODEV |
| 438 | 438 |
err error |
| 439 | 439 |
) |
| 440 |
- fulldest := filepath.Join(c.Rootfs, m.Destination) |
|
| 441 | 440 |
if m.Data != "" {
|
| 442 | 441 |
flags, data, err = mount.ParseTmpfsOptions(m.Data) |
| 443 | 442 |
if err != nil {
|
| ... | ... |
@@ -450,8 +449,6 @@ func (d *Driver) setupMounts(container *configs.Config, c *execdriver.Command) e |
| 450 | 450 |
Data: data, |
| 451 | 451 |
Device: "tmpfs", |
| 452 | 452 |
Flags: flags, |
| 453 |
- PremountCmds: genTmpfsPremountCmd(c.TmpDir, fulldest, m.Destination), |
|
| 454 |
- PostmountCmds: genTmpfsPostmountCmd(c.TmpDir, fulldest, m.Destination), |
|
| 455 | 453 |
PropagationFlags: []int{mountPropagationMap[volume.DefaultPropagationMode]},
|
| 456 | 454 |
}) |
| 457 | 455 |
continue |
| 458 | 456 |
deleted file mode 100644 |
| ... | ... |
@@ -1,56 +0,0 @@ |
| 1 |
-package native |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "fmt" |
|
| 5 |
- "os" |
|
| 6 |
- "os/exec" |
|
| 7 |
- "strings" |
|
| 8 |
- |
|
| 9 |
- "github.com/Sirupsen/logrus" |
|
| 10 |
- "github.com/opencontainers/runc/libcontainer/configs" |
|
| 11 |
-) |
|
| 12 |
- |
|
| 13 |
-func genTmpfsPremountCmd(tmpDir string, fullDest string, dest string) []configs.Command {
|
|
| 14 |
- var premount []configs.Command |
|
| 15 |
- tarPath, err := exec.LookPath("tar")
|
|
| 16 |
- if err != nil {
|
|
| 17 |
- logrus.Warn("tar command is not available for tmpfs mount: %s", err)
|
|
| 18 |
- return premount |
|
| 19 |
- } |
|
| 20 |
- if _, err = exec.LookPath("rm"); err != nil {
|
|
| 21 |
- logrus.Warn("rm command is not available for tmpfs mount: %s", err)
|
|
| 22 |
- return premount |
|
| 23 |
- } |
|
| 24 |
- tarFile := fmt.Sprintf("%s/%s.tar", tmpDir, strings.Replace(dest, "/", "_", -1))
|
|
| 25 |
- if _, err := os.Stat(fullDest); err == nil {
|
|
| 26 |
- premount = append(premount, configs.Command{
|
|
| 27 |
- Path: tarPath, |
|
| 28 |
- Args: []string{"-cf", tarFile, "-C", fullDest, "."},
|
|
| 29 |
- }) |
|
| 30 |
- } |
|
| 31 |
- return premount |
|
| 32 |
-} |
|
| 33 |
- |
|
| 34 |
-func genTmpfsPostmountCmd(tmpDir string, fullDest string, dest string) []configs.Command {
|
|
| 35 |
- var postmount []configs.Command |
|
| 36 |
- tarPath, err := exec.LookPath("tar")
|
|
| 37 |
- if err != nil {
|
|
| 38 |
- return postmount |
|
| 39 |
- } |
|
| 40 |
- rmPath, err := exec.LookPath("rm")
|
|
| 41 |
- if err != nil {
|
|
| 42 |
- return postmount |
|
| 43 |
- } |
|
| 44 |
- if _, err := os.Stat(fullDest); os.IsNotExist(err) {
|
|
| 45 |
- return postmount |
|
| 46 |
- } |
|
| 47 |
- tarFile := fmt.Sprintf("%s/%s.tar", tmpDir, strings.Replace(dest, "/", "_", -1))
|
|
| 48 |
- postmount = append(postmount, configs.Command{
|
|
| 49 |
- Path: tarPath, |
|
| 50 |
- Args: []string{"-xf", tarFile, "-C", fullDest, "."},
|
|
| 51 |
- }) |
|
| 52 |
- return append(postmount, configs.Command{
|
|
| 53 |
- Path: rmPath, |
|
| 54 |
- Args: []string{"-f", tarFile},
|
|
| 55 |
- }) |
|
| 56 |
-} |
| ... | ... |
@@ -319,10 +319,7 @@ unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap. |
| 319 | 319 |
|
| 320 | 320 |
$ docker run -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image |
| 321 | 321 |
|
| 322 |
- This command mounts a `tmpfs` at `/tmp` within the container. The mount copies |
|
| 323 |
-the underlying content of `my_image` into `/tmp`. For example if there was a |
|
| 324 |
-directory `/tmp/content` in the base image, docker will copy this directory and |
|
| 325 |
-all of its content on top of the tmpfs mounted on `/tmp`. The supported mount |
|
| 322 |
+ This command mounts a `tmpfs` at `/tmp` within the container. The supported mount |
|
| 326 | 323 |
options are the same as the Linux default `mount` flags. If you do not specify |
| 327 | 324 |
any options, the systems uses the following options: |
| 328 | 325 |
`rw,noexec,nosuid,nodev,size=65536k`. |
| ... | ... |
@@ -490,10 +490,7 @@ standard input. |
| 490 | 490 |
|
| 491 | 491 |
$ docker run -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image |
| 492 | 492 |
|
| 493 |
- This command mounts a `tmpfs` at `/tmp` within the container. The mount copies |
|
| 494 |
-the underlying content of `my_image` into `/tmp`. For example if there was a |
|
| 495 |
-directory `/tmp/content` in the base image, docker will copy this directory and |
|
| 496 |
-all of its content on top of the tmpfs mounted on `/tmp`. The supported mount |
|
| 493 |
+ This command mounts a `tmpfs` at `/tmp` within the container. The supported mount |
|
| 497 | 494 |
options are the same as the Linux default `mount` flags. If you do not specify |
| 498 | 495 |
any options, the systems uses the following options: |
| 499 | 496 |
`rw,noexec,nosuid,nodev,size=65536k`. |