How to run tests on CentOS 7 with Travis-CI? - docker

I try to use Travis-CI to test my ansible playbooks on CentOS 7.
I got an error:
error: unpacking of archive failed on file /usr/sbin/suexec: cpio: cap_set_file.
Also I installed docker with:
curl -sSL https://get.docker.com/ | sh
on my Ubuntu:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
But there is this error:
#docker run --rm=true -ti centos:7 /bin/bash
[root#08bf52d53465 /]#
[root#ca03cf7a13e2 /]# yum install httpd -y
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): extras/7/x86_64/primary_db | 74 kB 00:00:00
(2/4): base/7/x86_64/group_gz | 154 kB 00:00:01
(3/4): updates/7/x86_64/primary_db | 3.3 MB 00:00:06
(4/4): base/7/x86_64/primary_db | 5.1 MB 00:00:06
Determining fastest mirrors
* base: mirror.nonstop.co.il
* extras: centos.joinweb.co.il
* updates: centos.joinweb.co.il
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-31.el7.centos.1 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-31.el7.centos.1 for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: system-logos >= 7.92.1-1 for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package centos-logos.noarch 0:70.0.6-2.el7.centos will be installed
---> Package httpd-tools.x86_64 0:2.4.6-31.el7.centos.1 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
httpd x86_64 2.4.6-31.el7.centos.1 updates 2.7 M
Installing for dependencies:
apr x86_64 1.4.8-3.el7 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
centos-logos noarch 70.0.6-2.el7.centos updates 21 M
httpd-tools x86_64 2.4.6-31.el7.centos.1 updates 79 k
mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
=============================================================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 24 M
Installed size: 32 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/apr-1.4.8-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for apr-1.4.8-3.el7.x86_64.rpm is not installed
(1/6): apr-1.4.8-3.el7.x86_64.rpm | 103 kB 00:00:00
(2/6): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00
(3/6): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
Public key for httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm is not installed ] 559 kB/s | 764 kB 00:00:43 ETA
(4/6): httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm | 79 kB 00:00:01
(5/6): httpd-2.4.6-31.el7.centos.1.x86_64.rpm | 2.7 MB 00:00:03
(6/6): centos-logos-70.0.6-2.el7.centos.noarch.rpm | 21 MB 00:00:16
-----------------------------------------------------------------------------------------------------------------------------
Total 1.5 MB/s | 24 MB 00:00:16
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security#centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-1.1503.el7.centos.2.8.x86_64 (#CentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : apr-1.4.8-3.el7.x86_64 1/6
Installing : apr-util-1.5.2-6.el7.x86_64 2/6
Installing : httpd-tools-2.4.6-31.el7.centos.1.x86_64 3/6
Installing : mailcap-2.1.41-2.el7.noarch 4/6
Installing : centos-logos-70.0.6-2.el7.centos.noarch 5/6
Installing : httpd-2.4.6-31.el7.centos.1.x86_64 6/6
Error unpacking rpm package httpd-2.4.6-31.el7.centos.1.x86_64
error: unpacking of archive failed on file /usr/sbin/suexec: cpio: cap_set_file
error: httpd-2.4.6-31.el7.centos.1.x86_64: install failed
Verifying : centos-logos-70.0.6-2.el7.centos.noarch 1/6
Verifying : apr-1.4.8-3.el7.x86_64 2/6
Verifying : mailcap-2.1.41-2.el7.noarch 3/6
Verifying : apr-util-1.5.2-6.el7.x86_64 4/6
Verifying : httpd-tools-2.4.6-31.el7.centos.1.x86_64 5/6
Verifying : httpd-2.4.6-31.el7.centos.1.x86_64 6/6
Dependency Installed:
apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 centos-logos.noarch 0:70.0.6-2.el7.centos
httpd-tools.x86_64 0:2.4.6-31.el7.centos.1 mailcap.noarch 0:2.1.41-2.el7
Failed:
httpd.x86_64 0:2.4.6-31.el7.centos.1
Complete!
[root#ca03cf7a13e2 /]#
I created "special" docker image that includes an Ansible https://github.com/weldpua2008/docker-ansible/blob/ansible_1.9.2/centos/7/Dockerfile
Is there any possibilities to run tests of ansible playbook on CentOS 7?
So I updated /etc/default/docker with:
DOCKER_OPTS="-s devicemapper"
restarted docker:
service docker restart
docker run --rm=true -ti centos:7 /bin/bash
[root#16702cbf3f2c /]# yum install -y httpd
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
systemdcontainer | 1.9 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 154 kB 00:00:03
(2/4): extras/7/x86_64/primary_db | 74 kB 00:00:04
(3/4): updates/7/x86_64/primary_db | 3.3 MB 00:01:10
(4/4): base/7/x86_64/primary_db | 5.1 MB 00:01:22
systemdcontainer/primary_db | 20 kB 00:00:01
Determining fastest mirrors
* base: centos.syn.co.il
* extras: centos.syn.co.il
* updates: centos.syn.co.il
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-31.el7.centos.1 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-31.el7.centos.1 for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: system-logos >= 7.92.1-1 for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package centos-logos.noarch 0:70.0.6-2.el7.centos will be installed
---> Package httpd-tools.x86_64 0:2.4.6-31.el7.centos.1 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
httpd x86_64 2.4.6-31.el7.centos.1 updates 2.7 M
Installing for dependencies:
apr x86_64 1.4.8-3.el7 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
centos-logos noarch 70.0.6-2.el7.centos updates 21 M
httpd-tools x86_64 2.4.6-31.el7.centos.1 updates 79 k
mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
=============================================================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 24 M
Installed size: 32 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/updates/packages/httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm is not installed
(1/6): httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm | 79 kB 00:00:03
Public key for apr-util-1.5.2-6.el7.x86_64.rpm is not installed
(2/6): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:04
(3/6): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:02
(4/6): apr-1.4.8-3.el7.x86_64.rpm | 103 kB 00:00:06
(5/6): httpd-2.4.6-31.el7.centos.1.x86_64.rpm | 2.7 MB 00:00:52
(6/6): centos-logos-70.0.6-2.el7.centos.noarch.rpm | 21 MB 00:01:11
-----------------------------------------------------------------------------------------------------------------------------
Total 349 kB/s | 24 MB 00:01:11
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security#centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-1.1503.el7.centos.2.8.x86_64 (#CentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : apr-1.4.8-3.el7.x86_64 1/6
Installing : apr-util-1.5.2-6.el7.x86_64 2/6
Installing : httpd-tools-2.4.6-31.el7.centos.1.x86_64 3/6
Installing : mailcap-2.1.41-2.el7.noarch 4/6
Installing : centos-logos-70.0.6-2.el7.centos.noarch 5/6
Installing : httpd-2.4.6-31.el7.centos.1.x86_64 6/6
Verifying : centos-logos-70.0.6-2.el7.centos.noarch 1/6
Verifying : apr-1.4.8-3.el7.x86_64 2/6
Verifying : mailcap-2.1.41-2.el7.noarch 3/6
Verifying : apr-util-1.5.2-6.el7.x86_64 4/6
Verifying : httpd-tools-2.4.6-31.el7.centos.1.x86_64 5/6
Verifying : httpd-2.4.6-31.el7.centos.1.x86_64 6/6
Installed:
httpd.x86_64 0:2.4.6-31.el7.centos.1
Dependency Installed:
apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 centos-logos.noarch 0:70.0.6-2.el7.centos
httpd-tools.x86_64 0:2.4.6-31.el7.centos.1 mailcap.noarch 0:2.1.41-2.el7
Complete!
If there any possibility to do same on Travis CI. I didn't find in the manual http://docs.travis-ci.com/user/docker/ .
I can't edit docker settings https://travis-ci.org/weldpua2008/ansible-apache/jobs/79963906#L29:
$ echo 'DOCKER_OPTS="-s devicemapper"' >> /etc/default/docker; service docker restart
/home/travis/build.sh: line 41: /etc/default/docker: Permission denied
/etc/init.d/docker: 38: .: Can't open /etc/default/docker

Because of Travis CI Docker bug there is way to use new version of Docker. Thank to Dominic Jodoin from Travis CI team.
.travis.yml:
sudo: required
env:
#matrix:
- OS_TYPE=centos OS_VERSION=6 ANSIBLE_VERSION=1.9.2
branches:
only:
- master
# - stable
services:
- docker
before_install:
- sudo apt-get update
- sudo apt-get upgrade lxc-docker
- echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null
- sudo service docker restart
- sleep 5
- sudo docker pull weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION}
script:
# Run tests in Container
- sudo docker run --rm=true -v `pwd`:/ansible-apache:rw weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION} /bin/bash -c "/ansible-apache/tests/test-in-docker-image.sh ${OS_TYPE} ${OS_VERSION} ${ANSIBLE_VERSION}"
notifications:
email: false

You can consider using Circle CI. It is very similar to Travis CI (integration with github, yaml configuration), but faster. And for it is for free for open source! Here are some docs about docker:
https://circleci.com/docs/docker/

Basic usage to use CentOS on Travis CI is like this.
services: docker
...
install: docker build --rm -t sample -f Dockerfile_centos .
script: docker run --rm -t sample
You can refer below projects' cases.
https://github.com/brianmario/mysql2
https://github.com/junaruga/rpm-py-installer

Related

Install wget in Docker in Codebuild

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

Docker build fails with Error: Unable to find a match: e2fsprogs xfsprogs mdadm parted

Base image is
redhat ubi8/ubi
Step 5/10 : RUN yum install ca-certificates e2fsprogs xfsprogs util-linux mdadm parted lvm2 libudev-devel -y
---> Running in 792zfd35b185
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
Red Hat Universal Base Image 8 (RPMs) - BaseOS 2.1 MB/s | 803 kB 00:00
Red Hat Universal Base Image 8 (RPMs) - AppStre 5.9 MB/s | 3.0 MB 00:00
Red Hat Universal Base Image 8 (RPMs) - CodeRea 120 kB/s | 18 kB 00:00
Package ca-certificates-2021.2.50-80.0.el8_4.noarch is already installed.
No match for argument: e2fsprogs
No match for argument: xfsprogs
Package util-linux-2.32.1-35.el8.x86_64 is already installed.
No match for argument: mdadm
No match for argument: parted
Error: Unable to find a match: e2fsprogs xfsprogs mdadm parted
The command '/bin/sh -c yum install ca-certificates e2fsprogs xfsprogs util-linux mdadm parted lvm2 libudev-devel -y' returned a non-zero code: 1
Docker file is below
#Docker file
FROM registry.access.redhat.com/ubi8/ubi
...
...
...
RUN yum install ca-certificates e2fsprogs xfsprogs util-linux nvme-cli mdadm parted lvm2 libudev-devel -y
How to resolve it. I have an active subscription on my host machine
Uninstalling Docker and installing Buildah worked

The container becomes different from the container created with run

When I create a container using docker run I get the expected result - a container with all the packages installed.
When I exit the container (without changing anything) and try to enter it again using docker exec, it doesn't have the packages installed.
Can Someone explain why this happens?
ubuntu#DESKTOP:~$ docker pull ciscotestautomation/pyats:latest
latest: Pulling from ciscotestautomation/pyats
Digest: sha256:7e1134ee4c7bb0d78f5aec0b71414cf1ac79026fc4757203bf29b88af24b1a03
Status: Image is up to date for ciscotestautomation/pyats:latest
docker.io/ciscotestautomation/pyats:latest
ubuntu#DESKTOP:~$ docker run --name=run_only -it ciscotestautomation/pyats:latest /bin/bash
[Entrypoint] Starting pyATS Docker Image ...
[Entrypoint] Workspace Directory: /pyats
[Entrypoint] Activating workspace
root#34db091e8cf4:/pyats# pip list
Package Version
-------------------- -----------
aiofiles 0.7.0
aiohttp 3.7.4.post0
aiohttp-swagger 1.0.15
async-lru 1.0.2
async-timeout 3.0.1
attrs 21.2.0
certifi 2021.5.30
cffi 1.14.6
chardet 4.0.0
charset-normalizer 2.0.6
cryptography 3.4.8
dill 0.3.4
distro 1.6.0
idna 3.2
idna-ssl 1.1.0
Jinja2 2.11.3
junit-xml 1.9
MarkupSafe 1.1.1
multidict 5.1.0
pathspec 0.9.0
pip 21.2.4
psutil 5.8.0
pyats 21.9
pyats.aereport 21.9
pyats.aetest 21.9
pyats.async 21.9
pyats.connections 21.9
pyats.datastructures 21.9
pyats.easypy 21.9
pyats.kleenex 21.9
pyats.log 21.9
pyats.reporter 21.9
pyats.results 21.9
pyats.tcl 21.9
pyats.topology 21.9
pyats.utils 21.9
pycparser 2.20
python-engineio 3.14.2
python-socketio 4.6.1
PyYAML 5.4.1
requests 2.26.0
setuptools 58.1.0
six 1.16.0
typing-extensions 3.10.0.2
unicon 21.9
unicon.plugins 21.9
urllib3 1.26.7
wheel 0.37.0
yamllint 1.26.3
yarl 1.6.3
root#34db091e8cf4:/pyats# exit
exit
ubuntu#DESKTOP:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
34db091e8cf4 ciscotestautomation/pyats:latest "/bin/tini -- /entry…" 14 seconds ago Exited (0) 4 seconds ago run_only
ubuntu#DESKTOP:~$ docker start run_only
run_only
ubuntu#DESKTOP:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
34db091e8cf4 ciscotestautomation/pyats:latest "/bin/tini -- /entry…" 36 seconds ago Up 2 seconds run_only
ubuntu#DESKTOP:~$ docker exec -it run_only "/bin/bash"
root#34db091e8cf4:/pyats# pip list
Package Version
---------- -------
pip 21.1.3
setuptools 57.0.0
wheel 0.36.2
WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
root#34db091e8cf4:/pyats#
When you docker run the image, you'll note the following output:
[Entrypoint] Starting pyATS Docker Image ...
[Entrypoint] Workspace Directory: /pyats
[Entrypoint] Activating workspace
There is some sort of initialization script that is activating the workspace (probably a Python virtual environment).
When you docker exec into the container, you're just starting a shell, without any initialization. You need to run whatever initialization steps are performed when the container starts.
If you docker inspect the image, you can see that the ENTRYPOINT is set to /bin/tini -- /entrypoint.sh, and if you take a look at /entrypoint.sh, you find this, which includes:
echo "[Entrypoint] Activating workspace"
source ${WORKSPACE}/bin/activate
(Where $WORKSPACE is an environment variable that will already be set in your shell.)

alpine:3.14 docker libtls.so.20 conflict

So I am running into an error with the latest docker build from alpine. alpine:3.14.0 was released about a day ago and was trying to install libressl and libressl-dev and both seem to fail with the error below. My work around at the moment was to build using the alpine:3.12.0 as 3.12.0 seems to not have libretls installed. Although I would like to know how to fix this. I tried to remove libretls but that didn't work (error also below). Thanks
$ docker -v
Docker version 20.10.6, build 370c289
$ docker run --rm -it alpine /bin/ash
/ # apk add libressl-dev
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/5) Installing libressl3.3-libcrypto (3.3.3-r0)
(2/5) Installing libressl3.3-libssl (3.3.3-r0)
(3/5) Installing libressl3.3-libtls (3.3.3-r0)
ERROR: libressl3.3-libtls-3.3.3-r0: trying to overwrite usr/lib/libtls.so.20 owned by libretls-3.3.3-r0.
ERROR: libressl3.3-libtls-3.3.3-r0: trying to overwrite usr/lib/libtls.so.20.0.3 owned by libretls-3.3.3-r0.
(4/5) Installing pkgconf (1.7.4-r0)
(5/5) Installing libressl-dev (3.3.3-r0)
Executing busybox-1.33.1-r2.trigger
1 error; 41 MiB in 19 packages
/ #
/ # apk info libretls
libretls-3.3.3-r0 description:
port of libtls from libressl to openssl
libretls-3.3.3-r0 webpage:
https://git.causal.agency/libretls/
libretls-3.3.3-r0 installed size:
84 KiB
/ #
/ # apk del libretls
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/main: No such file or directory
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/community: No such file or directory
World updated, but the following packages are not removed due to:
libretls: busybox alpine-baselayout apk-tools
OK: 6 MiB in 14 packages
/ # exit
this is the upstream issue. Downgrading to alpine 3.13 works for now until the issue is fixed.
Normally docker images support fixed alpine versions (thanks to MrGlass comment). For example
python:3-alpine -> python:3-alpine3.13
php:7.4-fpm-alpine -> php:7.4-fpm-alpine3.13

Problems running kapacitor localinstall inside dockerfile

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

Resources