mirror of
https://github.com/docker/cli.git
synced 2026-01-18 08:21:31 +03:00
pkg/chrootarchive: provide TMPDIR for ApplyLayer
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack) Upstream-commit: 409f65bfd1bde5e45c68e2e1ecf68016ed91426b Component: engine
This commit is contained in:
@@ -3,6 +3,7 @@ package chrootarchive
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
@@ -21,9 +22,16 @@ func applyLayer() {
|
||||
if err := syscall.Chdir("/"); err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
if err := archive.ApplyLayer("/", os.Stdin); err != nil {
|
||||
tmpDir, err := ioutil.TempDir("/", "temp-docker-extract")
|
||||
if err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
os.Setenv("TMPDIR", tmpDir)
|
||||
if err := archive.ApplyLayer("/", os.Stdin); err != nil {
|
||||
os.RemoveAll(tmpDir)
|
||||
fatal(err)
|
||||
}
|
||||
os.RemoveAll(tmpDir)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user