mirror of
https://github.com/containers/podman.git
synced 2025-06-22 18:08:11 +08:00
Merge pull request #2609 from QiWang19/moveformats
move formats pkg to and vendor from buildah
This commit is contained in:
@ -2,8 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/storage/pkg/archive"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
package formats
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/containers/libpod/pkg/inspect"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestSetJSONFormatEncoder(t *testing.T) {
|
|
||||||
tt := []struct {
|
|
||||||
name string
|
|
||||||
imageData *inspect.ImageData
|
|
||||||
expected string
|
|
||||||
isTerminal bool
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "HTML tags are not escaped",
|
|
||||||
imageData: &inspect.ImageData{Author: "dave <dave@corp.io>"},
|
|
||||||
expected: `"Author": "dave <dave@corp.io>"`,
|
|
||||||
isTerminal: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "HTML tags are escaped",
|
|
||||||
imageData: &inspect.ImageData{Author: "dave <dave@corp.io>"},
|
|
||||||
expected: `"Author": "dave \u003cdave@corp.io\u003e"`,
|
|
||||||
isTerminal: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tc := range tt {
|
|
||||||
buf := bytes.NewBuffer(nil)
|
|
||||||
enc := setJSONFormatEncoder(tc.isTerminal, buf)
|
|
||||||
if err := enc.Encode(tc.imageData); err != nil {
|
|
||||||
t.Errorf("test %#v failed encoding: %s", tc.name, err)
|
|
||||||
}
|
|
||||||
if !strings.Contains(buf.String(), tc.expected) {
|
|
||||||
t.Errorf("test %#v expected output to contain %#v. Output:\n%v\n", tc.name, tc.expected, buf.String())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,8 +6,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/libpod/image"
|
"github.com/containers/libpod/libpod/image"
|
||||||
"github.com/containers/libpod/pkg/adapter"
|
"github.com/containers/libpod/pkg/adapter"
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/cmd/podman/imagefilters"
|
"github.com/containers/libpod/cmd/podman/imagefilters"
|
||||||
"github.com/containers/libpod/libpod/image"
|
"github.com/containers/libpod/libpod/image"
|
||||||
"github.com/containers/libpod/pkg/adapter"
|
"github.com/containers/libpod/pkg/adapter"
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
rt "runtime"
|
rt "runtime"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
"github.com/containers/libpod/pkg/adapter"
|
"github.com/containers/libpod/pkg/adapter"
|
||||||
"github.com/containers/libpod/version"
|
"github.com/containers/libpod/version"
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/cmd/podman/shared"
|
"github.com/containers/libpod/cmd/podman/shared"
|
||||||
"github.com/containers/libpod/pkg/adapter"
|
"github.com/containers/libpod/pkg/adapter"
|
||||||
cc "github.com/containers/libpod/pkg/spec"
|
cc "github.com/containers/libpod/pkg/spec"
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
of "github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
of "github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
||||||
"github.com/containers/libpod/pkg/rootless"
|
"github.com/containers/libpod/pkg/rootless"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/cmd/podman/shared"
|
"github.com/containers/libpod/cmd/podman/shared"
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
"github.com/containers/libpod/pkg/adapter"
|
"github.com/containers/libpod/pkg/adapter"
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
tm "github.com/buger/goterm"
|
tm "github.com/buger/goterm"
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
"github.com/containers/libpod/pkg/adapter"
|
"github.com/containers/libpod/pkg/adapter"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
||||||
"github.com/containers/libpod/cmd/podman/shared"
|
"github.com/containers/libpod/cmd/podman/shared"
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
|
@ -3,9 +3,9 @@ package main
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/libpod/image"
|
"github.com/containers/libpod/libpod/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
tm "github.com/buger/goterm"
|
tm "github.com/buger/goterm"
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
|
@ -7,9 +7,9 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
"github.com/containers/libpod/cmd/podman/libpodruntime"
|
||||||
"github.com/containers/libpod/libpod/image"
|
"github.com/containers/libpod/libpod/image"
|
||||||
"github.com/containers/libpod/pkg/trust"
|
"github.com/containers/libpod/pkg/trust"
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/libpod"
|
"github.com/containers/libpod/libpod"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/formats"
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/cmd/podman/formats"
|
|
||||||
"github.com/containers/libpod/pkg/adapter"
|
"github.com/containers/libpod/pkg/adapter"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -93,7 +93,7 @@ k8s.io/apimachinery kubernetes-1.10.13-beta.0 https://github.com/kubernetes/apim
|
|||||||
k8s.io/client-go kubernetes-1.10.13-beta.0 https://github.com/kubernetes/client-go
|
k8s.io/client-go kubernetes-1.10.13-beta.0 https://github.com/kubernetes/client-go
|
||||||
github.com/mrunalp/fileutils 7d4729fb36185a7c1719923406c9d40e54fb93c7
|
github.com/mrunalp/fileutils 7d4729fb36185a7c1719923406c9d40e54fb93c7
|
||||||
github.com/varlink/go 3ac79db6fd6aec70924193b090962f92985fe199
|
github.com/varlink/go 3ac79db6fd6aec70924193b090962f92985fe199
|
||||||
github.com/containers/buildah 11dd2197dfffedb40687de1d667e6c9fb0708de9
|
github.com/containers/buildah 345ffc2b29b4255a83cfa763db88799d8ec9c569 https://github.com/QiWang19/buildah
|
||||||
# TODO: Gotty has not been updated since 2012. Can we find replacement?
|
# TODO: Gotty has not been updated since 2012. Can we find replacement?
|
||||||
github.com/Nvveen/Gotty cd527374f1e5bff4938207604a14f2e38a9cf512
|
github.com/Nvveen/Gotty cd527374f1e5bff4938207604a14f2e38a9cf512
|
||||||
# do not go beyond the below commit as the next one requires a more recent
|
# do not go beyond the below commit as the next one requires a more recent
|
||||||
|
2
vendor/github.com/containers/buildah/imagebuildah/build.go
generated
vendored
2
vendor/github.com/containers/buildah/imagebuildah/build.go
generated
vendored
@ -293,7 +293,7 @@ func (b *Executor) Preserve(path string) error {
|
|||||||
|
|
||||||
// Try and resolve the symlink (if one exists)
|
// Try and resolve the symlink (if one exists)
|
||||||
// Set archivedPath and path based on whether a symlink is found or not
|
// Set archivedPath and path based on whether a symlink is found or not
|
||||||
if symLink, err := ResolveSymLink(b.mountPoint, path); err == nil {
|
if symLink, err := resolveSymlink(b.mountPoint, path); err == nil {
|
||||||
archivedPath = filepath.Join(b.mountPoint, symLink)
|
archivedPath = filepath.Join(b.mountPoint, symLink)
|
||||||
path = symLink
|
path = symLink
|
||||||
} else {
|
} else {
|
||||||
|
10
vendor/github.com/containers/buildah/imagebuildah/chroot_symlink.go
generated
vendored
10
vendor/github.com/containers/buildah/imagebuildah/chroot_symlink.go
generated
vendored
@ -24,9 +24,7 @@ func init() {
|
|||||||
reexec.Register(symlinkModifiedTime, resolveSymlinkTimeModified)
|
reexec.Register(symlinkModifiedTime, resolveSymlinkTimeModified)
|
||||||
}
|
}
|
||||||
|
|
||||||
// main() for grandparent subprocess. Its main job is to shuttle stdio back
|
// main() for resolveSymlink()'s subprocess.
|
||||||
// and forth, managing a pseudo-terminal if we want one, for our child, the
|
|
||||||
// parent subprocess.
|
|
||||||
func resolveChrootedSymlinks() {
|
func resolveChrootedSymlinks() {
|
||||||
status := 0
|
status := 0
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@ -57,9 +55,9 @@ func resolveChrootedSymlinks() {
|
|||||||
os.Exit(status)
|
os.Exit(status)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResolveSymLink (in the grandparent process) resolves any symlink in filename
|
// resolveSymlink uses a child subprocess to resolve any symlinks in filename
|
||||||
// in the context of rootdir.
|
// in the context of rootdir.
|
||||||
func ResolveSymLink(rootdir, filename string) (string, error) {
|
func resolveSymlink(rootdir, filename string) (string, error) {
|
||||||
// The child process expects a chroot and one path that
|
// The child process expects a chroot and one path that
|
||||||
// will be consulted relative to the chroot directory and evaluated
|
// will be consulted relative to the chroot directory and evaluated
|
||||||
// for any symbolic links present.
|
// for any symbolic links present.
|
||||||
@ -253,7 +251,7 @@ func hasSymlink(path string) (bool, string, error) {
|
|||||||
}
|
}
|
||||||
// if the symlink points to a relative path, prepend the path till now to the resolved path
|
// if the symlink points to a relative path, prepend the path till now to the resolved path
|
||||||
if !filepath.IsAbs(targetDir) {
|
if !filepath.IsAbs(targetDir) {
|
||||||
targetDir = filepath.Join(path, targetDir)
|
targetDir = filepath.Join(filepath.Dir(path), targetDir)
|
||||||
}
|
}
|
||||||
// run filepath.Clean to remove the ".." from relative paths
|
// run filepath.Clean to remove the ".." from relative paths
|
||||||
return true, filepath.Clean(targetDir), nil
|
return true, filepath.Clean(targetDir), nil
|
||||||
|
90
vendor/github.com/containers/buildah/run.go
generated
vendored
90
vendor/github.com/containers/buildah/run.go
generated
vendored
@ -1,7 +1,6 @@
|
|||||||
package buildah
|
package buildah
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -272,36 +271,6 @@ func addRlimits(ulimit []string, g *generate.Generator) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func addHosts(hosts []string, w io.Writer) error {
|
|
||||||
buf := bufio.NewWriter(w)
|
|
||||||
for _, host := range hosts {
|
|
||||||
values := strings.SplitN(host, ":", 2)
|
|
||||||
if len(values) != 2 {
|
|
||||||
return errors.Errorf("unable to parse host entry %q: incorrect format", host)
|
|
||||||
}
|
|
||||||
if values[0] == "" {
|
|
||||||
return errors.Errorf("hostname in host entry %q is empty", host)
|
|
||||||
}
|
|
||||||
if values[1] == "" {
|
|
||||||
return errors.Errorf("IP address in host entry %q is empty", host)
|
|
||||||
}
|
|
||||||
fmt.Fprintf(buf, "%s\t%s\n", values[1], values[0])
|
|
||||||
}
|
|
||||||
return buf.Flush()
|
|
||||||
}
|
|
||||||
|
|
||||||
func addHostsToFile(hosts []string, filename string) error {
|
|
||||||
if len(hosts) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
file, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrapf(err, "error creating hosts file %q", filename)
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
return addHosts(hosts, file)
|
|
||||||
}
|
|
||||||
|
|
||||||
func addCommonOptsToSpec(commonOpts *CommonBuildOptions, g *generate.Generator) error {
|
func addCommonOptsToSpec(commonOpts *CommonBuildOptions, g *generate.Generator) error {
|
||||||
// Resources - CPU
|
// Resources - CPU
|
||||||
if commonOpts.CPUPeriod != 0 {
|
if commonOpts.CPUPeriod != 0 {
|
||||||
@ -638,6 +607,59 @@ func (b *Builder) addNetworkConfig(rdir, hostPath string, chownOpts *idtools.IDP
|
|||||||
return cfile, nil
|
return cfile, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generateHosts creates a containers hosts file
|
||||||
|
func (b *Builder) generateHosts(rdir, hostname string, addHosts []string, chownOpts *idtools.IDPair) (string, error) {
|
||||||
|
hostPath := "/etc/hosts"
|
||||||
|
stat, err := os.Stat(hostPath)
|
||||||
|
if err != nil {
|
||||||
|
return "", errors.Wrapf(err, "error statting %q for container %q", hostPath, b.ContainerID)
|
||||||
|
}
|
||||||
|
|
||||||
|
hosts := bytes.NewBufferString("# Generated by Buildah\n")
|
||||||
|
orig, err := ioutil.ReadFile(hostPath)
|
||||||
|
if err != nil {
|
||||||
|
return "", errors.Wrapf(err, "unable to read %s", hostPath)
|
||||||
|
}
|
||||||
|
hosts.Write(orig)
|
||||||
|
for _, host := range addHosts {
|
||||||
|
// verify the host format
|
||||||
|
values := strings.SplitN(host, ":", 2)
|
||||||
|
if len(values) != 2 {
|
||||||
|
return "", errors.Errorf("unable to parse host entry %q: incorrect format", host)
|
||||||
|
}
|
||||||
|
if values[0] == "" {
|
||||||
|
return "", errors.Errorf("hostname in host entry %q is empty", host)
|
||||||
|
}
|
||||||
|
if values[1] == "" {
|
||||||
|
return "", errors.Errorf("IP address in host entry %q is empty", host)
|
||||||
|
}
|
||||||
|
hosts.Write([]byte(fmt.Sprintf("%s\t%s\n", values[1], values[0])))
|
||||||
|
}
|
||||||
|
|
||||||
|
if hostname != "" {
|
||||||
|
hosts.Write([]byte(fmt.Sprintf("127.0.0.1 %s\n", hostname)))
|
||||||
|
hosts.Write([]byte(fmt.Sprintf("::1 %s\n", hostname)))
|
||||||
|
}
|
||||||
|
cfile := filepath.Join(rdir, filepath.Base(hostPath))
|
||||||
|
if err = ioutils.AtomicWriteFile(cfile, hosts.Bytes(), stat.Mode().Perm()); err != nil {
|
||||||
|
return "", errors.Wrapf(err, "error writing /etc/hosts into the container")
|
||||||
|
}
|
||||||
|
uid := int(stat.Sys().(*syscall.Stat_t).Uid)
|
||||||
|
gid := int(stat.Sys().(*syscall.Stat_t).Gid)
|
||||||
|
if chownOpts != nil {
|
||||||
|
uid = chownOpts.UID
|
||||||
|
gid = chownOpts.GID
|
||||||
|
}
|
||||||
|
if err = os.Chown(cfile, uid, gid); err != nil {
|
||||||
|
return "", errors.Wrapf(err, "error chowning file %q for container %q", cfile, b.ContainerID)
|
||||||
|
}
|
||||||
|
if err := label.Relabel(cfile, b.MountLabel, false); err != nil {
|
||||||
|
return "", errors.Wrapf(err, "error relabeling %q in container %q", cfile, b.ContainerID)
|
||||||
|
}
|
||||||
|
|
||||||
|
return cfile, nil
|
||||||
|
}
|
||||||
|
|
||||||
func setupMaskedPaths(g *generate.Generator) {
|
func setupMaskedPaths(g *generate.Generator) {
|
||||||
for _, mp := range []string{
|
for _, mp := range []string{
|
||||||
"/proc/acpi",
|
"/proc/acpi",
|
||||||
@ -1081,15 +1103,11 @@ func (b *Builder) Run(command []string, options RunOptions) error {
|
|||||||
volumes := b.Volumes()
|
volumes := b.Volumes()
|
||||||
|
|
||||||
if !contains(volumes, "/etc/hosts") {
|
if !contains(volumes, "/etc/hosts") {
|
||||||
hostFile, err := b.addNetworkConfig(path, "/etc/hosts", rootIDPair)
|
hostFile, err := b.generateHosts(path, spec.Hostname, b.CommonBuildOpts.AddHost, rootIDPair)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
bindFiles["/etc/hosts"] = hostFile
|
bindFiles["/etc/hosts"] = hostFile
|
||||||
|
|
||||||
if err := addHostsToFile(b.CommonBuildOpts.AddHost, hostFile); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !contains(volumes, "/etc/resolv.conf") {
|
if !contains(volumes, "/etc/resolv.conf") {
|
||||||
|
Reference in New Issue
Block a user