buildah: buildah bud fails on RUN - go build
Description
Using the following Dockerfile, I am unable to get successfully run the buildah bud command:
# Run using --privileged
FROM quay.io/openshift-pipeline/buildah
ARG GIT_SOURCE="https://github.com/a-roberts/knative-helloworld"
ENV TLS_VERIFY="true"
ENV CONTEXT_PATH="/workspace/git-source"
ENV DOCKERFILE_PATH="/workspace/git-source/Dockerfile"
ENV TAG="testing"
WORKDIR ${CONTEXT_PATH}
# This is the above $GIT_SOURCE repo on my local
COPY git-source/ .
VOLUME "/var/lib/containers"
ENTRYPOINT ["/bin/sh", "-c", "buildah build-using-dockerfile --tls-verify=${TLS_VERIFY} --layers -f ${DOCKERFILE_PATH} -t ${TAG} -- ${CONTEXT_PATH}"]
The resulting log is:
STEP 1: FROM golang AS builder
Getting image source signatures
Copying blob sha256:c5e155d5a1d130a7f8a3e24cee0d9e1349bff13f90ec6a941478e558fde53c14
Copying blob sha256:221d80d00ae9675aad24913aacbadfac1ce8b7084f9765a6c0813486082c5c69
Copying blob sha256:4250b3117dca5e14edc32ebf1366cd54e4cda91f17610b76c504a86917ff8b95
Copying blob sha256:3b7ca19181b24b87e24423c01b490633bc1e47d2fcdc1987bf2e37949d6789b5
Copying blob sha256:aa24759e848fee3ef333af3dd3ae951eb042e8cd20b5fc0e28a2f3c52cc7e25f
Copying blob sha256:927e9eaeed1922f626e8a34f9a21b6029f36d4112cbb04dbdbd9065e107a59cb
Copying blob sha256:66293f4dacbd8884954f2c9332298ace627830801c3b484ba89ca424c619f374
Copying config sha256:7ced090ee82ee77beabd76ad1ba3b167acd8609b0b10c4ef46cee3ddf6e6fa5f
Writing manifest to image destination
Storing signatures
STEP 2: WORKDIR /go/src/github.com/knative/docs/helloworld
--> 9c3aa441b8638080568faaf59b277d07cb861f48195a3fbeec558dc5b01e2b2b
STEP 3: FROM 9c3aa441b8638080568faaf59b277d07cb861f48195a3fbeec558dc5b01e2b2b AS builder
STEP 4: COPY . .
STEP 5: FROM bf5d138956b0270fb67c8e0d61d134d54f75639beb3acb9e71f384676235c88a AS builder
--> bf5d138956b0270fb67c8e0d61d134d54f75639beb3acb9e71f384676235c88a
STEP 6: RUN CGO_ENABLED=0 GOOS=linux go build -v -o helloworld
build cache is required, but could not be located: GOCACHE is not defined and neither $XDG_CACHE_HOME nor $HOME are defined
subprocess exited with status 1
subprocess exited with status 1
error building at step {Env:[PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin GOLANG_VERSION=1.12.5 GOPATH=/go] Command:run Args:[CGO_ENABLED=0 GOOS=linux go build -v -o helloworld] Flags:[] Attrs:map[] Message:RUN CGO_ENABLED=0 GOOS=linux go build -v -o helloworld Original:RUN CGO_ENABLED=0 GOOS=linux go build -v -o helloworld}: exit status 1
I have gotten Kaniko to build this repository. Curious if this issue is regarding some flags I have no set properly to the buildah command. I have tried setting the $BUILDAH_ISOLATION
env and the corresponding --isolation
flag (saw on another issue that could do something). I have run this on my 3.11 OKD cluster and locally on macOS (although still through the quay images) and experience the same error.
Steps to reproduce the issue:
- Build above Dockerfile
- Run using
--privileged
Describe the results you received:
Error during go build regarding ENV $GOCACHE
/$HOME
not being set (which they are?)
Describe the results you expected: Clean build
Output of rpm -q buildah
or apt list buildah
:
package buildah is not installed
Output of buildah version
:
buildah: command not found...
Output of podman version
if reporting a podman build
issue:
podman: command not found...
Output of cat /etc/*release
:
NAME="Red Hat Enterprise Linux Server"
VERSION="7.6 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.6"
PRETTY_NAME="OpenShift Enterprise"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.6:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.6
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.6"
Red Hat Enterprise Linux Server release 7.6 (Maipo)
Red Hat Enterprise Linux Server release 7.6 (Maipo)
Output of uname -a
:
Linux tereso-okd 3.10.0-957.12.1.el7.x86_64 #1 SMP Wed Mar 20 11:34:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Output of cat /etc/containers/storage.conf
:
# storage.conf is the configuration file for all tools
# that share the containers/storage libraries
# See man 5 containers-storage.conf for more information
# The "container storage" table contains all of the server options.
[storage]
# Default Storage Driver
driver = "overlay"
# Temporary storage location
runroot = "/var/run/containers/storage"
# Primary Read/Write location of container storage
graphroot = "/var/lib/containers/storage"
[storage.options]
# Storage options to be passed to underlying storage drivers
# AdditionalImageStores is used to pass paths to additional Read/Only image stores
# Must be comma separated list.
additionalimagestores = [
]
# Size is used to set a maximum size of the container image. Only supported by
# certain container storage drivers.
size = ""
# OverrideKernelCheck tells the driver to ignore kernel checks based on kernel version
override_kernel_check = "true"
# Remap-UIDs/GIDs is the mapping from UIDs/GIDs as they should appear inside of
# a container, to UIDs/GIDs as they should appear outside of the container, and
# the length of the range of UIDs/GIDs. Additional mapped sets can be listed
# and will be heeded by libraries, but there are limits to the number of
# mappings which the kernel will allow when you later attempt to run a
# container.
#
# remap-uids = 0:1668442479:65536
# remap-gids = 0:1668442479:65536
# Remap-User/Group is a name which can be used to look up one or more UID/GID
# ranges in the /etc/subuid or /etc/subgid file. Mappings are set up starting
# with an in-container ID of 0 and the a host-level ID taken from the lowest
# range that matches the specified name, and using the length of that range.
# Additional ranges are then assigned, using the ranges which specify the
# lowest host-level IDs first, to the lowest not-yet-mapped container-level ID,
# until all of the entries have been used for maps.
#
# remap-user = "storage"
# remap-group = "storage"
[storage.options.thinpool]
# Storage Options for thinpool
# autoextend_percent determines the amount by which pool needs to be
# grown. This is specified in terms of % of pool size. So a value of 20 means
# that when threshold is hit, pool will be grown by 20% of existing
# pool size.
# autoextend_percent = "20"
# autoextend_threshold determines the pool extension threshold in terms
# of percentage of pool size. For example, if threshold is 60, that means when
# pool is 60% full, threshold has been hit.
# autoextend_threshold = "80"
# basesize specifies the size to use when creating the base device, which
# limits the size of images and containers.
# basesize = "10G"
# blocksize specifies a custom blocksize to use for the thin pool.
# blocksize="64k"
# directlvm_device specifies a custom block storage device to use for the
# thin pool. Required if you setup devicemapper
# directlvm_device = ""
# directlvm_device_force wipes device even if device already has a filesystem
# directlvm_device_force = "True"
# fs specifies the filesystem type to use for the base device.
# fs="xfs"
# log_level sets the log level of devicemapper.
# 0: LogLevelSuppress 0 (Default)
# 2: LogLevelFatal
# 3: LogLevelErr
# 4: LogLevelWarn
# 5: LogLevelNotice
# 6: LogLevelInfo
# 7: LogLevelDebug
# log_level = "7"
# min_free_space specifies the min free space percent in a thin pool require for
# new device creation to succeed. Valid values are from 0% - 99%.
# Value 0% disables
# min_free_space = "10%"
# mkfsarg specifies extra mkfs arguments to be used when creating the base
# device.
# mkfsarg = ""
# mountopt specifies extra mount options used when mounting the thin devices.
# mountopt = ""
# use_deferred_removal Marking device for deferred removal
# use_deferred_removal = "True"
# use_deferred_deletion Marking device for deferred deletion
# use_deferred_deletion = "True"
# xfs_nospace_max_retries specifies the maximum number of retries XFS should
# attempt to complete IO when ENOSPC (no space) error is returned by
# underlying storage device.
# xfs_nospace_max_retries = "0"
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (13 by maintainers)
Commits related to this issue
- WIP - Add default /root if empty on chroot iso Checks to see if the $HOME envvar has been set and if not, trys to set it as best as possible. Putting this up for WIP as I've only tested in a root an... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 5 years ago
- WIP - Add default /root if empty on chroot iso Checks to see if the $HOME envvar has been set and if not, trys to set it as best as possible. Putting this up for WIP as I've only tested in a root an... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 5 years ago
- WIP - Add default /root if empty on chroot iso Checks to see if the $HOME envvar has been set and if not, trys to set it as best as possible. Putting this up for WIP as I've only tested in a root an... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 5 years ago
- WIP - Add default /root if empty on chroot iso Checks to see if the $HOME envvar has been set and if not, trys to set it as best as possible. Putting this up for WIP as I've only tested in a root an... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 5 years ago
- WIP - Add default /root if empty on chroot iso Checks to see if the $HOME envvar has been set and if not, trys to set it as best as possible. Putting this up for WIP as I've only tested in a root an... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 5 years ago
- WIP - Add default /root if empty on chroot iso Checks to see if the $HOME envvar has been set and if not, trys to set it as best as possible. Putting this up for WIP as I've only tested in a root an... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 5 years ago
- Add default /root if empty on chroot iso Checks to see if the $HOME envvar has been set and if not, trys to set it as best as possible. Fixes: #1592 Signed-off-by: TomSweeneyRedHat <tsweeney@redhat... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 5 years ago
- Add default /root if empty on chroot iso Checks to see if the $HOME envvar has been set and if not, trys to set it as best as possible. Fixes: #1592 Signed-off-by: TomSweeneyRedHat <tsweeney@redhat... — committed to TomSweeneyRedHat/buildah by TomSweeneyRedHat 5 years ago
I’ll let @vbatts or @nalind talk about the differences in levels as I’m not very well versed. However, I’m working on putting together a fix so that $HOME will be defined when using chrooot isolation and that should hopefully cure the problem.
runc
sets$HOME
if the configuration it receives doesn’t include a value, but we currently don’t when we’re usingchroot
isolation. Fixing this probably involves extendingpkg/chrootuser
to look up home directory locations, and if the spec doesn’t include a value forHOME
, havingchroot
set it to the value it finds, or/
if no value is found.