Skip to content

Commit a06a5fc

Browse files
fix(stapel): custom LD_LIBRARY_PATH in the base image might lead to failed builds
werf overrides LD_LIBRARY_PATH to prevent unexpected behaviour but only for Stapel with Docker-daemon builds. Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
1 parent 1698925 commit a06a5fc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/container_backend/legacy_stage_image_container.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func (c *LegacyStageImageContainer) prepareServiceRunOptions(ctx context.Context
186186
serviceRunOptions.Workdir = "/"
187187
serviceRunOptions.Entrypoint = stapel.BashBinPath()
188188
serviceRunOptions.User = "0:0"
189+
serviceRunOptions.Env["LD_LIBRARY_PATH"] = ""
189190

190191
stapelContainerName, err := stapel.GetOrCreateContainer(ctx)
191192
if err != nil {
@@ -250,6 +251,13 @@ func (c *LegacyStageImageContainer) prepareInheritedCommitOptions(ctx context.Co
250251
inheritedOptions.Entrypoint = fmt.Sprintf("[\"%s\"]", strings.Join(fromImageInspect.Config.Entrypoint, "\", \""))
251252
}
252253

254+
for _, e := range fromImageInspect.Config.Env {
255+
pair := strings.SplitN(e, "=", 2)
256+
if pair[0] == "LD_LIBRARY_PATH" {
257+
inheritedOptions.Env[pair[0]] = pair[1]
258+
}
259+
}
260+
253261
inheritedOptions.User = fromImageInspect.Config.User
254262
if fromImageInspect.Config.WorkingDir != "" {
255263
inheritedOptions.Workdir = fromImageInspect.Config.WorkingDir

0 commit comments

Comments
 (0)