The container becomes different from the container created with run - docker

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.)

Related

Java Docker build slave finds java 8 even though it is not installed

Background
I have a Jenkins server on Ubuntu 18.04 running Java version 11, checked by visiting /manage/systemInfo
java.specification.version 11
I have implemented docker build slaves based on Ubuntu 22.04 where I have specified that the java version should be 11:
# install java for Jenkins
RUN apt-get install -qy openjdk-11-jdk
I was wondering that all the build nodes stood as offline, and reading the log saw this:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
This question references List of Java class file format major version numbers? the Class versions:
52 is java 8
55 is java 11
and sure enough, a little further back in the log:
[11/14/22 18:35:38] [SSH] Checking java version of java
[11/14/22 18:35:38] [SSH] java -version returned 1.8.0_312.
so I went hunting for the culprit:
Attempts to find the culprit
sudo docker container exec 20e1bfe2b182 ls -l /usr/bin/java returned
/usr/bin/java -> /etc/alternatives/java
sudo docker container exec 20e1bfe2b182 ls -l /etc/alternatives/java returned
/etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
and even injected RUN java -version into my Dockerfile before the line installing opendjk (which indicated no java was installed...)
On the host I have run apt list --installed |grep jdk
openjdk-11-jdk/bionic-updates,bionic-security,now 11.0.17+8-1ubuntu2~18.04 amd64 [installed]
openjdk-11-jdk-headless/bionic-updates,bionic-security,now 11.0.17+8-1ubuntu2~18.04 amd64 [installed]
openjdk-11-jre/bionic-updates,bionic-security,now 11.0.17+8-1ubuntu2~18.04 amd64 [installed]
openjdk-11-jre-headless/bionic-updates,bionic-security,now 11.0.17+8-1ubuntu2~18.04 amd64 [installed,automatic]
... the same command on the docker image gave similar results...
find -name java* 2>/dev/null run from / did not give anything useful either
which java output
HOST:
$ which java
/usr/bin/java
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Nov 24 2018 /usr/bin/java -> /etc/alternatives/java
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 43 Jan 25 2022 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
docker
$ sudo docker compose run man which java
/usr/bin/java
$ sudo docker compose run man ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Nov 14 20:28 /usr/bin/java -> /etc/alternatives/java
$ sudo docker compose run man ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 43 Nov 14 20:28 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
echo $PATH output
HOST
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
docker
$ sudo docker compose run man echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
Potential workaround
Adding this to my Dockerfile seems to almost solve the issue:
RUN ln -s /usr/lib/jvm/java-11-openjdk-amd64/ /home/jenkins/jdk
RUN chown jenkins:jenkins /home/jenkins/jdk
Question
... so where does the JDK version 8 come from?

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

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

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

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

Docker 1.3 fails to start on RHEL6.5

I had earlier followed https://docs.docker.com/installation/rhel/ to install docker on rhel6.5. This used to work till today, till I decided to run "yum update" and upgraded to docker1.3.
Now, /etc/init.d/docker start fails.
-bash-4.1$ sudo /etc/init.d/docker status
docker dead but pid file exists
Contents of /var/log/docker:
-bash-4.1$ more /var/log/docker
\nSun Nov 30 23:29:14 IST 2014\n
2014/11/30 23:29:14 docker daemon: 1.3.1 c78088f/1.3.1; execdriver: native; grap
hdriver:
[dd907331] +job serveapi(unix:///var/run/docker.sock)
[info] WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64, whic
h might be unstable running docker. Please upgrade your kernel to 3.8.0.
/usr/bin/docker: relocation error: /usr/bin/docker: symbol dm_task_get_info_with
_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with lin
k time reference
I don't have an option to upgrade to rhel7 yet, and have already tried to
yum downgrade - but yum list doesn't list the older version anymore
compile the older docker source, but docker doesn't let you build a binary anymore without the docker binary installed :(
/usr/bin/docker: relocation error: /usr/bin/docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
I ran into this at work this week (also on RHEL6.5). I believe the lib-device-mapper that you have isn't exporting a symbol ("Base") that Docker needs. I solved this by upgrading lib-device-mapper to version 1.02.90.
You may have to enable the public_ol6_latest repo in order to get this package.
sudo yum-config-manager --enable public_ol6_latest
And then install the package:
sudo yum install device-mapper-event-libs
TL;DR: In my case I needed to upgrade the package device-mapper-libs on CentOS/RHEL 6.5. Details below.
$ yum update -y device-mapper-libs
On RHEL/CentOS 6.5, I got the same error when trying to run the docker daemon:
$ docker -d
INFO[0000] +job serveapi(unix:///var/run/docker.sock)
INFO[0000] WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0.
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
docker: relocation error: docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
While troubleshooting I came across the discussion docker.io: docker does't run after upgrade for Debian.
For reference here was my environment before the "fix":
$ uname -a
Linux build1 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release
CentOS release 6.5 (Final)
Before upgrading device-mapper-libs was at version 1.02.79. In the Debian bug report linked above, it was pointed out that Docker 1.4.1 (which is a different version than what the original poster asked about) is compiled against a newer version of device-mapper-libs (libdevmapper 2:1.02.90-1, note that the package name in Debian is different).
$ yum info device-mapper-libs
Installed Packages
Name : device-mapper-libs
Arch : x86_64
Version : 1.02.79
Release : 8.el6
<...snip...>
Updating device-mapper-libs fixed the problem:
$ yum update -y device-mapper-libs
# Yep, the package was updated to the latest version (1.02.90)
$ rpm -qi device-mapper-libs
Name : device-mapper-libs Relocations: (not relocatable)
Version : 1.02.90 Vendor: CentOS
Release : 2.el6_6.1 Build Date: Wed 26 Nov 2014
<...snip...>
Once the update is completed, the docker daemon will start successfully:
$ # docker -d
INFO[0000] +job serveapi(unix:///var/run/docker.sock)
INFO[0000] WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0.
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
INFO[0000] +job init_networkdriver()
INFO[0000] -job init_networkdriver() = OK (0)
INFO[0000] Loading containers: start.
INFO[0000] Loading containers: done.
INFO[0000] docker daemon: 1.4.1 5bc2ff8/1.4.1; execdriver: native-0.2; graphdriver: devicemapper
INFO[0000] +job acceptconnections()
INFO[0000] -job acceptconnections() = OK (0)
Hope this helps!
I faced the same problem when installing Docker 1.5 on CentOS 7 on Vagrant/VBox. Upgrading DevMapper fixed the problem. To do so, run the command:
$ sudo yum update device-mapper
I met this issue after install docker 1.6 in centOS7 and cannot run docker successfully. After
yum install lvm2
it works for me in centOS7 :)
Hope this useful for people who had same problem in centOS7.

Resources