I am trying to install Kapacitor over Cent-OS base, but, I am facing problems with executing the localinstall command (or so I think) when I build the dockerfile.
My dockerfile is as follows:
FROM centos-base:7
ENV CONFIG_HOME /usr/local/bin
RUN curl -O https://dl.influxdata.com/kapacitor/releases/kapacitor-0.13.1.x86_64.rpm
RUN yum localinstall kapacitor-0.13.1.x86_64.rpm
COPY kapacitor.conf $CONFIG_HOME
ENTRYPOINT["/bin/bash"]
When I build it, I get the following response:
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM centos-base:7
---> 9ab68a0dd16a
Step 2 : ENV CONFIG_HOME /usr/local/bin
---> Running in ef5b7206e55d
---> 7c1b42d279db
Removing intermediate container ef5b7206e55d
Step 3 : RUN curl -O https://dl.influxdata.com/kapacitor/releases/kapacitor-0.13.1.x86_64.rpm
---> Running in 681bb29474f9
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.8M 100 10.8M 0 0 123k 0 0:01:29 0:01:29 --:--:-- 224k
---> 99b4e77c89f2
Removing intermediate container 681bb29474f9
Step 4 : RUN yum localinstall kapacitor-0.13.1.x86_64.rpm
---> Running in d67ad03f4830
Loaded plugins: fastestmirror, ovl
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Examining kapacitor-0.13.1.x86_64.rpm: kapacitor-0.13.1-1.x86_64
Marking kapacitor-0.13.1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kapacitor.x86_64 0:0.13.1-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
kapacitor x86_64 0.13.1-1 /kapacitor-0.13.1.x86_64 41 M
Transaction Summary
================================================================================
Install 1 Package
Total size: 41 M
Installed size: 41 M
Is this ok [y/d/N]: Exiting on user command
Your transaction was saved, rerun it with:
yum load-transaction /tmp/yum_save_tx.2016-08-31.04-00.gvfpqf.yumtx
The command '/bin/sh -c yum localinstall kapacitor-0.13.1.x86_64.rpm' returned a non-zero code: 1
Where am I going wrong? Can't I execute a localinstall inside Dockerfile? Thanks!
Replace
RUN yum localinstall kapacitor-0.13.1.x86_64.rpm
with
RUN yum -y localinstall kapacitor-0.13.1.x86_64.rpm
Related
I'm using the serverless framework to build an application that is using a docker image. In the Dockerfile I have this command
RUN yum install wget -y
RUN wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.2-linux-x86_64.tar.gz
which works fine locally (windows) and on an Linux EC2 however when I run this through my build on codebuild (Image: aws/codebuild/amazonlinux2-x86_64-standard:4.0 with runtime-versions: docker 20) I get an error
Step 12/19 : RUN yum install wget -y
---> Running in f68d5e0607c3
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.amzn2.1 will be installed
--> Processing Dependency: libidn.so.11(LIBIDN_1.0)(64bit) for package: wget-1.14-18.amzn2.1.x86_64
--> Processing Dependency: libidn.so.11()(64bit) for package: wget-1.14-18.amzn2.1.x86_64
--> Running transaction check
---> Package libidn.x86_64 0:1.28-4.amzn2.0.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
wget x86_64 1.14-18.amzn2.1 amzn2-core 547 k
Installing for dependencies:
libidn x86_64 1.28-4.amzn2.0.2 amzn2-core 209 k
Transaction Summary
================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 757 k
Installed size: 2.6 M
Downloading packages:
--------------------------------------------------------------------------------
Total 7.1 MB/s | 757 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libidn-1.28-4.amzn2.0.2.x86_64 1/2
Installing : wget-1.14-18.amzn2.1.x86_64 2/2
Rpmdb checksum is invalid: dCDPT(pkg checksums): libidn.x86_64 0:1.28-4.amzn2.0.2 - u
The command '/bin/sh -c yum install wget -y' returned a non-zero code: 1
Below is docker build -t test:test . log
Sending build context to Docker daemon 1.225MB
Step 1/3 : FROM ppc64le/ubuntu:jammy
---> b4cdd8bc1823
Step 2/3 : ARG DEBIAN_FRONTEND=noninteractive
---> Using cache
---> 0d6079ed0b29
Step 3/3 : RUN apt-get update
---> Running in fca7ae125244
The command '/bin/sh -c apt-get update' returned a non-zero code: 132
It is clear to me that apt-get update is causing a problem but I don't know how to solve it. I googled everywhere but doesn't seem that peopple are getting this error code. Is it something related with ppc64le related? Any clues?
Per man bash:
"When a command terminates on a fatal signal N, bash uses the value of 128+N as the exit status"
So a 132 code indicates signal 4. which per kill -l
$ kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
is SIGILL, illegal instruction. So either you aren't running on a POWER9+ ppc64le machine, or your qemu setup isn't emulating it.
Power8 machines can fail on SIGILL as apt-get can get compiled with POWER9 instructions (as I found out in docker library issue #12726).
Note 22.04 jammy is POWER 9/10+ per release, and build.
I'm trying to make my own image of the random scheduler in a Raspberry Pi Kubernetes cluster, but when I use the command
docker build -t angel96eur/marton-randomscheduler .
I get this:
Sending build context to Docker daemon 185.9kB
Step 1/13 : FROM golang:1.11-alpine as backend
---> 2bf7a3ec2cd3
Step 2/13 : RUN apk add --update --no-cache bash ca-certificates curl git make tzdata
---> Using cache
---> 5e5d9d12a87e
Step 3/13 : RUN mkdir -p /go/src/github.com/martonsereg/scheduler
---> Using cache
---> 98179cd910c6
Step 4/13 : ADD Gopkg.* Makefile /go/src/github.com/martonsereg/scheduler/
---> Using cache
---> 70c615ff07f6
Step 5/13 : WORKDIR /go/src/github.com/martonsereg/scheduler
---> Using cache
---> 7cdb09255a20
Step 6/13 : RUN make vendor
---> Running in 2f0555b065c7
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | INSTALL_DIRECTORY=bin DEP_RELEASE_TAG=v0.5.0 sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5230 100 5230 0 0 14487 0 --:--:-- --:--:-- --:--:-- 14487
ARCH = arm
OS = linux
Will install into bin
Release Tag = v0.5.0
Fetching https://github.com/golang/dep/releases/tag/v0.5.0..
Fetching https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-arm..
Request failed with code 404
make: *** [Makefile:37: bin/dep-0.5.0] Error 1
The command '/bin/sh -c make vendor' returned a non-zero code: 2
Where the error could be?
Your logs show the release download failed while building your container:
Release Tag = v0.5.0
Fetching https://github.com/golang/dep/releases/tag/v0.5.0..
Fetching https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-arm..
Request failed with code 404
Looking at the release assets, golang/dep repo v0.5.0 doesn't have a dep-linux-arm release asset. The closest one that has an arm version seems to bev0.5.1 so you might want to change your DEP_RELEASE_TAG to that.
From what I understood, it is possible to build an arm64v8 image on the Docker Hub infrastructure (that use amd64). According to this thread it can be done using Qemu.
So I added a pre_build hook:
#!/bin/bash
docker run --rm --privileged multiarch/qemu-user-static:register --reset
The Qemu binaries are also downloaded inside the container:
FROM alpine AS builder
RUN apk update
RUN apk add curl
WORKDIR /qemu
# downloaded here...
RUN curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static .
FROM area51/gdal:arm64v8-2.2.3
# ...then added here
COPY --from=builder /qemu/qemu-arm-static /usr/bin
RUN apt-get update
RUN apt-get install -y libgdal-dev python3-pip libspatialindex-dev unar bc
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
ENV C_INCLUDE_PATH=/usr/include/gdal
ADD ./requirements.txt .
RUN pip3 install -r requirements.txt
RUN mkdir /code
ADD . /code/
WORKDIR /code
CMD python3.5 server.py
EXPOSE 8080
Unfortunatly, it doesn't works:
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '140.82.114.4' to the list of known hosts.
Switched to a new branch 'auto-build'
Executing pre_build hook...
Unable to find image 'multiarch/qemu-user-static:register' locally
register: Pulling from multiarch/qemu-user-static
bdbbaa22dec6: Pulling fs layer
42399a41a764: Pulling fs layer
ed8a5179ae11: Pulling fs layer
1ec39da9c97d: Pulling fs layer
1ec39da9c97d: Waiting
42399a41a764: Verifying Checksum
42399a41a764: Download complete
bdbbaa22dec6: Verifying Checksum
bdbbaa22dec6: Download complete
ed8a5179ae11: Verifying Checksum
ed8a5179ae11: Download complete
1ec39da9c97d: Verifying Checksum
1ec39da9c97d: Download complete
bdbbaa22dec6: Pull complete
42399a41a764: Pull complete
ed8a5179ae11: Pull complete
1ec39da9c97d: Pull complete
Digest: sha256:7502ce31890ab5da0ab6e5e5edc1e2563caa45da1c5d76aaf7dc4252aea926dc
Status: Downloaded newer image for multiarch/qemu-user-static:register
Setting /usr/bin/qemu-alpha-static as binfmt interpreter for alpha
Setting /usr/bin/qemu-arm-static as binfmt interpreter for arm
Setting /usr/bin/qemu-armeb-static as binfmt interpreter for armeb
Setting /usr/bin/qemu-sparc-static as binfmt interpreter for sparc
Setting /usr/bin/qemu-sparc32plus-static as binfmt interpreter for sparc32plus
Setting /usr/bin/qemu-sparc64-static as binfmt interpreter for sparc64
Setting /usr/bin/qemu-ppc-static as binfmt interpreter for ppc
Setting /usr/bin/qemu-ppc64-static as binfmt interpreter for ppc64
Setting /usr/bin/qemu-ppc64le-static as binfmt interpreter for ppc64le
Setting /usr/bin/qemu-m68k-static as binfmt interpreter for m68k
Setting /usr/bin/qemu-mips-static as binfmt interpreter for mips
Setting /usr/bin/qemu-mipsel-static as binfmt interpreter for mipsel
Setting /usr/bin/qemu-mipsn32-static as binfmt interpreter for mipsn32
Setting /usr/bin/qemu-mipsn32el-static as binfmt interpreter for mipsn32el
Setting /usr/bin/qemu-mips64-static as binfmt interpreter for mips64
Setting /usr/bin/qemu-mips64el-static as binfmt interpreter for mips64el
Setting /usr/bin/qemu-sh4-static as binfmt interpreter for sh4
Setting /usr/bin/qemu-sh4eb-static as binfmt interpreter for sh4eb
Setting /usr/bin/qemu-s390x-static as binfmt interpreter for s390x
Setting /usr/bin/qemu-aarch64-static as binfmt interpreter for aarch64
Setting /usr/bin/qemu-aarch64_be-static as binfmt interpreter for aarch64_be
Setting /usr/bin/qemu-hppa-static as binfmt interpreter for hppa
Setting /usr/bin/qemu-riscv32-static as binfmt interpreter for riscv32
Setting /usr/bin/qemu-riscv64-static as binfmt interpreter for riscv64
Setting /usr/bin/qemu-xtensa-static as binfmt interpreter for xtensa
Setting /usr/bin/qemu-xtensaeb-static as binfmt interpreter for xtensaeb
Setting /usr/bin/qemu-microblaze-static as binfmt interpreter for microblaze
Setting /usr/bin/qemu-microblazeel-static as binfmt interpreter for microblazeel
Setting /usr/bin/qemu-or1k-static as binfmt interpreter for or1k
KernelVersion: 4.4.0-1060-aws
Components: [{u'Version': u'18.03.1-ee-3', u'Name': u'Engine', u'Details': {u'KernelVersion': u'4.4.0-1060-aws', u'Os': u'linux', u'BuildTime': u'2018-08-30T18:42:30.000000000+00:00', u'ApiVersion': u'1.37', u'MinAPIVersion': u'1.12', u'GitCommit': u'b9a5c95', u'Arch': u'amd64', u'Experimental': u'false', u'GoVersion': u'go1.10.2'}}]
Arch: amd64
BuildTime: 2018-08-30T18:42:30.000000000+00:00
ApiVersion: 1.37
Platform: {u'Name': u''}
Version: 18.03.1-ee-3
MinAPIVersion: 1.12
GitCommit: b9a5c95
Os: linux
GoVersion: go1.10.2
Starting build of index.docker.io/cl00e9ment/open-elevation:latest...
Step 1/18 : FROM alpine AS builder
---> e7d92cdc71fe
Step 2/18 : RUN apk update
---> Running in a62df65e92ac
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
v3.11.3-6-gb1cd1b7acf [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]
v3.11.3-5-gb26b362c4a [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]
OK: 11259 distinct packages available
Removing intermediate container a62df65e92ac
---> 9decee1216df
Step 3/18 : RUN apk add curl
---> Running in 440f41edd63d
(1/4) Installing ca-certificates (20191127-r0)
(2/4) Installing nghttp2-libs (1.40.0-r0)
(3/4) Installing libcurl (7.67.0-r0)
(4/4) Installing curl (7.67.0-r0)
Executing busybox-1.31.1-r9.trigger
Executing ca-certificates-20191127-r0.trigger
OK: 7 MiB in 18 packages
Removing intermediate container 440f41edd63d
---> 54c70441e6d3
Step 4/18 : WORKDIR /qemu
Removing intermediate container 58b03a58671b
---> 89c6e32b5854
Step 5/18 : RUN curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static .
---> Running in 11696855e374
[91m % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0[0m
[91m 100 619 0 619 0 0 3327 0 --:--:-- --:--:-- --:--:-- 3917
[0m
qemu-3.0.0+resin-arm/
[91m 19 1678k 19 321k 0 0 846k 0 0:00:01 --:--:-- 0:00:01 846k[0m
[91m 100 1678k 100 1678k 0 0 2535k 0 --:--:-- --:--:-- --:--:-- 4828k
[0m
qemu-3.0.0+resin-arm/qemu-arm-static
Removing intermediate container 11696855e374
---> 80668e34eb37
Step 6/18 : FROM area51/gdal:arm64v8-2.2.3
---> 4edbfeef8f1a
Step 7/18 : COPY --from=builder /qemu/qemu-arm-static /usr/bin
---> 91c196da9280
Step 8/18 : RUN apt-get update
---> Running in 37c97a8903f3
[91mstandard_init_linux.go:190: exec user process caused "no such file or directory"
[0m
Removing intermediate container 37c97a8903f3
The command '/bin/sh -c apt-get update' returned a non-zero code: 1
The error:
standard_init_linux.go:190: exec user process caused "no such file or directory"
Looks like that one:
standard_init_linux.go:190: exec user process caused "exec format error"
That I'm starting to be used to see and means that there is an architecture problem. Does the first one mean the same thing?
If there is again an architecture problem, what I'm missing?
I was able to fix the "no such file or directory" error using the solution from this article...
https://stackoverflow.com/a/56063679/1194731
I have the following dockerfile which is very simple using Centos:latest as the base image.
docker file exits on any command other than 0 as error code/code
yum check-update returns a status code of 100 for successful operation
The docker file is as follows
FROM centos:latest
MAINTAINER xyz (xyz#gmail.com)
ENTRYPOINT ["/bin/sh", "-lc", "ocp-indent"]
RUN yum -y check-update
When I try to build the image , the process is getting run as follows, but it gets killed without building the image successfully
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM centos:latest
latest: Pulling from library/centos
7dc0dca2b151: Pull complete
Digest:
sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Status: Downloaded newer image for centos:latest
---> 49f7960eb7e4
Step 2/4 : MAINTAINER xyz (xyz#gmail.com)
---> Running in c5284bbfb10e
---> b2334a38cc19
Removing intermediate container c5284bbfb10e
Step 3/4 : ENTRYPOINT /bin/sh -lc ocp-indent
---> Running in 55b9adafca35
---> 02df626e85d6
Removing intermediate container 55b9adafca35
Step 4/4 : RUN yum check-update
---> Running in 3f9d47e74522
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: mirror.its.dal.ca
* extras: centos.les.net
* updates: centos.les.net
binutils.x86_64 2.27-28.base.el7_5.1
updates
gnupg2.x86_64 2.0.22-5.el7_5
updates
python.x86_64 2.7.5-69.el7_5
updates
python-libs.x86_64 2.7.5-69.el7_5
updates
**The command '/bin/sh -c yum check-update' returned a non-zero code: 100**
yum check-update is expected to exit with status 100 if updates are available, as described in its documentation:
check-update
Implemented so you could know if your machine had any updates that needed to be applied
without running it interactively. Returns exit value of 100 if there are packages available for an update. Also returns a list of the packages to be updated in list format.
Returns 0 if no packages are available for update. Returns 1 if an error occurred. Running in verbose mode also shows obsoletes.
Similarly, the docker RUN command is expected to terminate on any nonzero exit status. If you want to force the command to ignore an exit status of 100 (but still treat other failures as erroneous), you can do so as follows:
RUN yum -y check-update || { rc=$?; [ "$rc" -eq 100 ] && exit 0; exit "$rc"; }
That the Docker RUN command treats any nonzero exit status as a failure is standard UNIX convention (the only successful exit status is 0), and is explicitly implemented in dockerfile/containerbackend.go:
if status := <-waitC; status.ExitCode() != 0 {
close(finished)
logCancellationError(cancelErrCh,
fmt.Sprintf("a non-zero code from ContainerWait: %d", status.ExitCode()))
return &statusCodeError{code: status.ExitCode(), err: status.Err()}
}