Skip to content

Commit 858933f

Browse files
committed
fix(buildah): unable to find "pasta" binary
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
1 parent a21b3e9 commit 858933f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pkg/buildah/common.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import (
2020
)
2121

2222
const (
23-
DefaultShmSize = "65536k"
23+
DefaultShmSize = "65536k"
24+
DefaultContainersConfig = `
25+
[network]
26+
default_rootless_network_cmd="slirp4netns"
27+
`
2428
DefaultSignaturePolicy = `{"default": [{"type": "insecureAcceptAnything"}], "transports": {"docker-daemon": {"": [{"type": "insecureAcceptAnything"}]}}}`
2529
DefaultRegistriesConfig = `unqualified-search-registries = ["docker.io"]`
2630
BuildahImage = "registry.werf.io/werf/buildah:v1.22.3-1"

pkg/buildah/native_linux.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ type NativeBuildah struct {
7171
InstanceTmpDir string
7272
ConfigTmpDir string
7373
SignaturePolicyPath string
74+
ContainersConfigPath string
7475
RegistriesConfigPath string
7576
RegistriesConfigDirPath string
7677
Insecure bool
@@ -111,6 +112,15 @@ func NewNativeBuildah(commonOpts CommonBuildahOpts, opts NativeModeOpts) (*Nativ
111112
return nil, fmt.Errorf("unable to write file %q: %w", b.SignaturePolicyPath, err)
112113
}
113114

115+
b.ContainersConfigPath = filepath.Join(b.ConfigTmpDir, "containers.conf")
116+
if err := ioutil.WriteFile(b.ContainersConfigPath, []byte(DefaultContainersConfig), os.ModePerm); err != nil {
117+
return nil, fmt.Errorf("unable to write file %q: %w", b.ContainersConfigPath, err)
118+
}
119+
120+
if err := os.Setenv("CONTAINERS_CONF", b.ContainersConfigPath); err != nil {
121+
return nil, fmt.Errorf("unable to set env var CONTAINERS_CONF: %w", err)
122+
}
123+
114124
b.RegistriesConfigPath = filepath.Join(b.ConfigTmpDir, "registries.conf")
115125
if err := ioutil.WriteFile(b.RegistriesConfigPath, []byte(DefaultRegistriesConfig), os.ModePerm); err != nil {
116126
return nil, fmt.Errorf("unable to write file %q: %w", b.RegistriesConfigPath, err)

0 commit comments

Comments
 (0)