Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Dockerfile: Include /sbin dir in PATH #3211

Merged
merged 1 commit into from Jul 23, 2020
Merged

Dockerfile: Include /sbin dir in PATH #3211

merged 1 commit into from Jul 23, 2020

Conversation

ricardo-larosa
Copy link
Contributor

When trying to install additional tools in the Dockerfile of a custom image based on the Flux image.
Example:

FROM docker.io/fluxcd/flux:1.20.0
RUN apk add --no-cache jq && apk add --no-cache gettext

You get this:

/bin/sh: apk: not found

A workaround is to set the PATH before like this:

FROM docker.io/fluxcd/flux:1.20.0
ENV PATH=/bin:/sbin:/usr/bin:/usr/local/bin:/usr/lib/kubeyaml
RUN apk add --no-cache jq && apk add --no-cache gettext
RUN wget -q -O /usr/bin/yq $(wget -q -O - https://api.github.com/repos/mikefarah/yq/releases/latest | jq -r '.assets[] | select(.name == "yq_linux_amd64") | .browser_download_url') \
    && chmod +x /usr/bin/yq

With this change, I don't have to set the PATH in the Dockerfile

Include /sbin dir in PATH
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @ricardo-larosa

@stefanprodan stefanprodan added the build About the build or test scaffolding label Jul 23, 2020
@stefanprodan stefanprodan changed the title Include /sbin dir in PATH Dockerfile: Include /sbin dir in PATH Jul 23, 2020
@stefanprodan stefanprodan merged commit d277b78 into fluxcd:master Jul 23, 2020
@ricardo-larosa ricardo-larosa deleted the patch-1 branch July 23, 2020 13:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build About the build or test scaffolding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants