error with dbus and gesettings inside docker container - docker

after using the command RUN apt-get install -y dbus building and then running the container I try to change system proxy with the command gsettings set org.gnome.system.proxy.https host 'proxy-adress' but I get the output failed to commit changes to dconf: Failed to execute child process ?dbus-launch? (No such file or directory). I assume that dbus was not installed so I check the path with whereis dbus but the output is empty. is it uninstalling itself?.

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?

RStudio in docker image does not deal with some librairies

I have a problem to use the docker rstudio-image rocker/rstudio proposed
on https://www.rocker-project.org/ (docker containers for R). Since I am a beginner with both docker and RStudio, I suspect the problem comes from me and does not deserve a bug report:
I open a proper terminal with 'Docker Quickstart Terminal'
where I run the image with docker run -d -p 8787:8787 -e DISABLE_AUTH=true -v <...>:/home/rstudio/<...> --name rstudio rocker/rstudio
in my browser I then get a nice RStudio instance at the address http://192.168.99.100:8787
but in this instance I can't install several packages such as xml2. I get the message:
Using PKG_CFLAGS=
Using PKG_LIBS=-lxml2
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
* deb: libxml2-dev (Debian, Ubuntu, etc)
* rpm: libxml2-devel (Fedora, CentOS, RHEL)
* csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘xml2’
* removing ‘/usr/local/lib/R/site-library/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
I don't know whether xml2 is on the image but the file libxml-2.0.pc does exist on my laptop in the directory /opt/local/lib/pkgconfig and pkg-config is in /opt/local/bin. So I tried linking these pkg paths when running
the image (to see what happen when I play with the image environment
in RStudio), adding options -v
/opt/local/lib/pkgconfig:/home/rstudio/lib/pkgconfig -v
/opt/local/bin:/home/rstudio/bin to the run command. But it doesn't work: for some reason
I don't see the content of lib/pkgconfig in RStudio...
Also the RStudio instance does not accept root/sudo commands so I can't
use tools such as apt-get in the RStudio terminal
so, what's the trick ?
Libraries on your laptop (the host for docker) are not available for docker containers. You should create a custom image with required libraries, create a Dockerfile like this:
FROM rocker/rstudio
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libxml2-dev # add any additional libraries you need
CMD ["/init"]
Above I added the libxml2-dev but you can add as many libraries as you need.
Then build your image using this command (you need to execute below command in directory there you created Dockerfile):
docker build -t my_rstudio:0.1 .
Then you can start your container:
docker run -d -p 8787:8787 -e DISABLE_AUTH=true --name rstudio my_rstudio:0.1
(you can add any additional arguments like -v to above).

Unable to run pre-installation script /var/lib/dpkg/tmp.ci/preinst

I try to install some program in Docker, but get:
preinst /var/lib/dpkg/tmp.ci/preinst install
The requested cluster does not exist and cluster creation is not supported.
dpkg: error processing archive arch.deb (--install):
subprocess new pre-installation script returned error exit status 1
postrm /var/lib/dpkg/tmp.ci/postrm abort-install
The Docker container is created FROM ubuntu:14.04
The code I use in Dockerfile is:
RUN sudo ./dir/install.sh
This code works fine on Ubuntu 14.04 directly, but not in Docker. Any thoughts? Do I need to install/add something extra first?

Installing cassandra on RHEL using docker

I am trying to install cassandra on RHEL-7 from source code using docker.
I have done following steps inside the container:
1 - yum install -y git java-1.8.0-openjdk-devel ant
2- export JAVA_HOME=/usr/lib/jvm/java-1.8.0
3- export PATH=$PATH:$JAVA_HOME/bin
4- export ANT_HOME=/usr/share/ant
5- export PATH=$PATH:$ANT_HOME/bin
6- export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
7 -git clone https://github.com/apache/cassandra.git
8 -cd cassandra && ant
The build is successful. But when I try to start cassandra server inside container I am getting following error:
A fatal error has been detected by the Java Runtime Environment:
Internal Error (cppInterpreter_zero.cpp:812), pid=836, tid=4397984807184
Error: Unimplemented()
Any idea?

Google Compute Engine Startup Script: Not running on startup

I'm trying to get the following script to run on a CentOS instance at start up on GCE.
I have the custom metadata "startup-script" set on the instance name and the following script as the value.
The script isn't executing on startup, reboot or when I run /usr/share/google/run-startup-scripts but does execute if I create it locally on the instance and execute there
What obvious thing am I missing?
#! /bin/bash
# Installs apache and a custom homepage
# 1234567 123456
#Get this servers name from the metadata server and use the header to authenticate
THIS_SERVER_NAME=$(curl http://metadata/computeMetadata/v1/instance/hostname -H "X-Google-Metadata-Request: True")
#Turn off IPtables firewall that comes installed
service iptables stop
#Install apache
yum install -y httpd
#start apache
service httpd start
#create custom default homepage for this server
cat <<EOF > /var/www/html/index.html
<html><body><h1>Hello World</h1>
<p>This is Server: $THIS_SERVER_NAME</p>
</body></html>
EOF
I was curious how's the situation with this today (6 years after original post) so I've created three VM's with CentOS 6,7 & 8 and put the startup script in place.
I used the script from the initial questions without modifications.
After VM's were created in all three cases httpd was installed and was running. Partial serial console outputs below.
Results for CentOS 6:
Installed:
httpd.x86_64 0:2.2.15-69.el6.centos
...
Complete!
Starting httpd: [ OK ]
exit status 0
Results for CentOS 7:
Installed:
httpd.x86_64 0:2.4.6-93.el7.centos
...
Complete!
centos7 systemd: Starting The Apache HTTP Server...
centos7 systemd: Started The Apache HTTP Server.
GCEMetadataScripts: startup-script exit status 0
Results for CentOS 8:
Installing:
httpd x86_64 2.4.37-21.module_el8.2.0+494+1df74eae
...
systemd[1]: Starting The Apache HTTP Server...
systemd[1]: Started The Apache HTTP Server.
GCEMetadataScripts: startup-script exit status 0
Whatever was causing the script not to run at the time this question was asked it is not the case now.
My personal experience was facing with two issues:
1) Commands that needed interaction, would not run properly on startup. For examples, apt-get install asks you to confirm the process (Y/n)? In that case, you can turn off interaction and pass "yes" by replacing
yum install foo
apt-get install foo
with
yum -y --assumeyes install foo
apt-get -y --force-yes install foo
Also, if you're using Debian, the following before any command would suppress the need for interaction:
sudo DEBIAN_FRONTEND=noninteractive <your command here, e.g., apt-get -y install foo>
2) The other obvious issue is sometimes you have to wait for the process to finish, and that may happen much later than your instance shows up as "running".
I used CentOS 7 as base image and install some libraries but it doesn't work. After switch to CentOS 6 and it works well (seems CentOS 7 has issue).

Resources