Newer version of Docker gives permission errors during build - docker

I've created a Dockerfile to install IBM Rational Rhapsody on a 32bit Ubuntu image, which builds correctly with Docker 18.03.0-ce on Windows 7 but fails with Docker 18.09.2 on a Linux Mint 19 VM (Ubuntu Bionic repos). IBM's Java-based installer throws a permissions issue, and the Docker changelogs didn't show any obvious reasons for this.
The Dockerfile up to the failing command is as follows:
FROM i386/ubuntu:xenial-20181005 AS installation
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends unzip
COPY Rhapsody812Linux.zip .
RUN unzip -qq Rhapsody812Linux.zip -d Rhapsody812Linux
RUN cd Rhapsody812Linux/disk1/im/installer.linux.gtk.x86 \
&& ./installc input install-rhapsody.xml -acceptLicense
The failure I'm seeing is:
org.eclipse.core.runtime.CoreException: Failed to create artifact table of contents at '/var/ibm/InstallationManager/installRegistry/metadata'.
...IBM's library stack trace truncated by me...
Caused by: java.io.IOException: Permission denied
at sun.nio.ch.FileChannelImpl$1.release(FileChannelImpl.java:115)
at sun.nio.ch.FileChannelImpl$SimpleFileLockTable.removeAll(FileChannelImpl.java:1024)
at sun.nio.ch.FileChannelImpl.implCloseChannel(FileChannelImpl.java:112)
at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:108)
...IBM's library stack trace truncated by me...
ERROR: Error restoring Installation Manager state.
ERROR: Failed to create InstallRegistry metadata repository: /var/ibm/InstallationManager/installRegistry/metadata.
I found a forum post stating this can happen if /tmp isn't accessible, which it seems to be:
drwxr-xr-x 2 root root 4096 Mar 18 20:35 /tmp
I ran an Ubuntu Xenial image interactively to see what I could find out, and the installer does create /var/ibm/InstallationManager/installRegistry/metadata so I'm not sure where the permission issue is coming from.
What could be different between these Docker versions, and how can I resolve this build failure in the newer version?

After running the installer multiple times consecutively, I got a "CRIMC1086E ERROR" and found an IBM Knowledge Center entry mentioning this code. It suggests disabling the IBM Installation Manager's repository locking, which resolved the issue for me.
To disable the repository lock, add cic.repo.locking=false to config.ini. In my case, I made the following addition to my Dockerfile:
# Disable repo lock to avoid potential permissions issue when lock is released
# Experienced with Docker 18.09.2 on a Linux Mint 19 VM
RUN cd Rhapsody812Linux/disk1/im/installer.linux.gtk.x86/configuration \
&& echo 'cic.repo.locking=false' >> config.ini

Related

No address associated with hostname inside docker container

I am using a customized version of Ubuntu18.04 and I have a docker container where I tried to install a .deb package for the usage of a FLIR camera. To do so I downloaded from this website the file spinnaker-2.5.0.80-Ubuntu18.04-arm64-pkg.tar.gz, as suggested for Ubuntu18.04.
I followed those instructions to install everything, which basically means the following commands:
apt-get install libusb-1.0-0
tar xvfz spinnaker-2.5.0.80-Ubuntu18.04-arm64-pkg.tar.gz
cd spinnaker-2.5.0.80-arm64
./install_spinnaker_arm.sh
During this process the first errors arose, which I could fix through the installation of iputils-ping and lsb-release inside the docker container:
apt install iputils-ping
apt install -y lsb-release
However, afterwards another error arose:
/var/lib/dpkg/tmp.ci/preinst: 28 /var/lib/dpkg/tmp.ci/preinst: errmsg: not found
dpkg: error processing archive libspinnaker_2.5.0.80_arm64.deb (--install):
new libspinnaker package pre-installation script subprocess returned error exit status 127
ping: zone2.flir.net: No address associated with hostname
Errors were encountered while processing:
libspinnaker_2.5.0.80_arm64.deb
I though it is a nework issue inside the container but I do have internet connection, which I checked through:
ping www.google.com
Does anybody has a suggestion why I am not able to install the spinnaker SDK inside my docker container? Or has an explanation for me, what "no address associated with hostname" means? I am thankfull for every hint in any direction. Maybe it is an issue because I moved my docker data folder to an external SD card?

Yum update fails -Centos 7 - dockerbuild

I have frequently built docker container using centos 7 as base image. But now I am getting error when I run,
RUN yum update add \
bash \
&& rm -rfv /var/cache/apk/*
ERROR:
Loaded plugins: fastestmirror, ovl
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
Contact the upstream for the repository and get them to fix the problem.
Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
`subscription-manager repos --disable=<repoid>`
Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64 Could not retrieve
mirrorlist
http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container
error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org;
Name or service not known" The command '/bin/sh -c yum update add
bash && rm -rfv /var/cache/apk/*' returned a non-zero code: 1
I also saw few resolutions to use "dhclient" but this error happens when i do docker-compose build.
I ran into this problem attempting to run the same Dockerfile, which fetched several software packages using yum, on two different platforms; one macOS, the other an Ubuntu 16.04-based Linux OS (elementaryOS Loki), both using the official packages from docker.com.
My theory is that the Linux package is just more restrictive out of the box, security-wise, than the macOS one. Maybe this is configurable with some kind of /etc/something config file, but I don't have the expertise with Docker to say for sure. EDIT: See my comment below.
What I can say is there was no additional configuration required for me on macOS (10.11 El Capitan); just docker build . worked fine, and yum processes from the Dockerfile were able to reach all the remote repositories.
In the Ubuntu-derived Linux distro, however, it was necessary to use
docker build --network host .
followed by
docker run -it --network host <image> <command>
when I wanted to run a process inside that image which required internet access.
This may be the case for other Debian-derived systems as well.
There are, of course, security considerations which need to be taken into account when allowing a long-running Docker container to communicate through the host network adapter, unrestricted, and one would do well to review the appropriate documentation in that regard.
My assumption is that for some reason network behavior in docker varies based on distribution.
Try to use:
docker run -d --net mybridge centos
or
docker network create -d bridge mybridge
docker run -d --net mybridge centos
It should start working. Or just edit /etc/hosts and add mirror address
Name: mirrorlist.centos.org
Address: 67.219.148.138
root cause of the issue is, container proxy settings were wrong. Just corrected the proxy settings at the below location and worked.
/root/.docker/config.json

docker Error with pre-create check: "We support Virtualbox starting with version 5

I'm trying to create docker machine host using the following command in fedora OS version 25.
docker-machine create -driver=virtualbox host01
I get below error while executing the command.
Error with pre-create check: "We support Virtualbox starting with version 5. Your VirtualBox install is \"WARNING:
The vboxdrv kernel module is not loaded.
Either there is no module available for the current kernel (4.10.12-200.fc25.x86_64) or it failed to load.
Please try load the kernel module by executing as root
dnf install akmod-VirtualBox kernel-devel-4.10.12-200.fc25.x86_64 akmods --kernels 4.10.12-200.fc25.x86_64 && systemctl restart systemd-modules-load.service
You will not be able to start VMs until this problem is fixed.\\n5.1.26r117224\".
Please upgrade at https://www.virtualbox.org"
I have already virtualbox latest version installed. Running the command suggested by
sudo dnf install akmod-VirtualBox kernel-devel-4.10.12-200.fc25.x86_64 akmods --kernels 4.10.12-200.fc25.x86_64 && systemctl restart systemd-modules-load.service
I got the below error
Last metadata expiration check: 0:48:35 ago on Thu Aug 17 22:38:47 2017.
Package akmods-0.5.6-7.fc25.noarch is already installed, skipping.
No package --kernels available.
No package 4.10.12-200.fc25.x86_64 available.
Any suggestions?
I also had this problem and for this I upgrade Virtual box to 5.2 using following commands. This link help me
sudo apt-get remove virtualbox virtualbox-5.1
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" >> /etc/apt/sources.list.d/virtualbox.list'
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install virtualbox-5.2
Hope this helps.
For windows users, in 2022 such problem still exists. So for those who use last build (now it is virtualBox-6.1.32-149290-Win), try to use version that starts with prefix 5. But not all '5' versions work. For example, for me worked only version 5.2.42 while versions: 5.2.18, 5.2.20, 5.2.44 didn't work
Helped for win 11 x64

Yum install / update not working inside docker images but working otherwise from the centos machine

I am able to yum install, or yum update from the server, but when trying to do same (as specified in the Dockerfile) inside a docker container, it fails stating the following common error :
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
my Docker file is a simple :
FROM centos:centos7
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf
RUN echo "nameserver 8.8.4.4" >> /etc/resolv.conf
RUN yum -y update; yum clean all
RUN yum -y install epel-release; yum clean all
RUN yum -y install python-pip; yum clean all
I have tried various things like adding ip_resolve=4 in /etc/yum.conf, or addinf 8.8.8.8 and 4.4.4.4 to /etc/resolv.conf and other methods, in vain.
here's the docker info :
Containers: 28
Running: 0
Paused: 0
Stopped: 28
Images: 144
Server Version: 1.13.0
docker-compose version 1.10.1, build b252738
docker-py version: 2.0.2
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
Please help. I am only running things under a VPN, no proxy.
machine is an AMI : 3.10.0-514.el7.x86_64.
Need I add it's IP anywhere insde docker container? Please help.
TIA!

Docker build error There are no enabled repos

On Centos7.1 Docker host : I am building a docker image with Dockerfile having command
RUN yum -y install deltarpm yum-utils --disablerepo=*-eus-* --disablerepo=*-htb-* --disablerepo=*-ha-* --disablerepo=*-rt-* --disablerepo=*-lb-* --disablerepo=*-rs-* --disablerepo=*-sap-*
During the run of docker build command : docker build -t <image>, I get the error:
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
How can I fix this? Do I need to enable yum repo inside docker also?
(Note that I can install these packages in Docker host)
Using yum (the Yellowdog Updater, Modified) in your Dockerfile has nothing to do with your host CentOS.
It has to do with your base image used by your Dockerfile (FROM xxx).
The error message that matters is:
There are no enabled repos.
You can see a manual resolution in "RHEL 7 - Solution to "There are no enabled repos" message"
If you simply want to play around and install software without the need for up to date Red Hat subscription you can mount your downloaded redhat ISO image and make it your default local repository and be able to install software.
To enable your local repository and thus overcome the There are no enabled repos, first mount your REHL7 iso image:
[root#rhel7 ~]# mkdir /media/rhel7-repo-iso
[root#rhel7 ~]# mount /dev/cdrom /media/rhel7-repo-iso/
mount: /dev/sr0 is write-protected, mounting read-only
That is not supported by a Dockerfile/docker image though.
You are better off using a base image which does not require any subscription model. For example:
FROM fedora
RUN yum update -y
RUN yum install -y httpd
Again, this has nothing to do with your host.
The OP mentions following Red Hat Enterprise Linux Atomic Host 7 Getting Started Guide
That guide clearly includes:
To enable software updates, you must register your Red Hat Enterprise Linux Atomic Host installation.
This is done with the subscription-manager command as described below.
If your system is located on a network that requires the use of an HTTP proxy, please see the Red Hat Knowledge Base Article on configuring subscription manager to use an HTTP proxy. The --name= option may be included if you wish to provide an easy to remember name to be used when reviewing subscription records.
$ sudo subscription-manager register --username=<username> --auto-attach

Resources