We currently encounter a strange issue with the latest KDE / Archlinux releases.
We cannot get KDE's Purpose framework to compile inside a docker container, although it works fine on our host machines. We tried to compile it with GCC and Clang.
The error we receive is:
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::SaveAsShare()':
saveasplugin.cpp:(.text+0x81): undefined reference to `vtable for SaveAsShare'
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::~SaveAsShare()':
saveasplugin.cpp:(.text+0x113): undefined reference to `vtable for SaveAsShare'
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::~SaveAsShare()':
saveasplugin.cpp:(.text+0x133): undefined reference to `vtable for SaveAsShare'
collect2: error: ld returned 1 exit status
make[2]: *** [src/plugins/saveas/CMakeFiles/saveasplugin.dir/build.make:122: bin/kf5/purpose/saveasplugin.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:1149: src/plugins/saveas/CMakeFiles/saveasplugin.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
You can reproduce the docker environment with the following Dockerfile:
FROM archlinux/base
RUN pacman -Syu --noconfirm && pacman --noconfirm -S git base-devel cmake extra-cmake-modules asp sudo
RUN useradd -ms /bin/bash arch
RUN echo 'arch ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers
USER arch
WORKDIR /home/arch
RUN asp checkout purpose
WORKDIR /home/arch/purpose/trunk
RUN gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys 58D0EE648A48B3BB
(If you only have IPv6 available and no IPv4, you need to edit line 9)
After you build the container run it and execute makepkg -s --noconfirm
It will now build the archlinux package and you will encounter the above mentioned error during the linking phase.
We currently do not even have the slightest clue what the reason for this error could be, as it builds without any problems on our host machines. Any ideas?
We also tested different base archlinux docker images such as pritunl/archlinux.
Environment:
purpose: 5.43.0-1
GCC: 7.3.0
CLang: 5.0.1-2
This is a bug with the statx syscall used by the MOC to generate the appropriate cpp files. In the default confined configuration, docker uses seccomp to prevent or allow certain syscalls, which does not allow the statx syscall. See this for allowed syscalls.
This bug has been reported on the archlinux bugtracker, qt bugtracker and docker bugtracker already, without a (permanent) solution.
Solution 1:
Run your docker container with docker run --security-opt seccomp:unconfined as per this suggestion.
Solution 2:
Patch or downgrade to remove the statx syscall from qt.
Related
I'm trying to run docker on embedded Linux running OpenWRT.
Since the embedded Linux is a "resource constraint" I don't want Docker to install already installed packages, therefore I want to call a custom shell script with docker:
RUN $CMD_STRING = $(gcc)
RUN $CMD_OUTPUT=$(${CMD_STRING} -version)
RUN if [[ ${CMD_OUTPUT} == *"not found"* ]]; echo ${CMD_STRING} "was NOT FOUND, Installing..."
opkg update
opkg install gcc
fi
I will like a similar simple if/else structure.
I keep getting:
-ash: gcc: not found
-ash: -rw-r--r--: not found
I don't have some OpenWRT for test but this may work if its only an "ash" and "docker" problem. I tested it on alpine since it also have ash (from busybox).
Dockerfile:
from alpine:latest
RUN ash -c "if ! gcc 2>/dev/null; then echo 'not found..'; echo 'installing..'; fi"
Build it:
docker build .
Sending build context to Docker daemon 3.072kB
Step 1/2 : from alpine:latest
---> 389fef711851
Step 2/2 : RUN ash -c "if ! gcc 2>/dev/null; then echo 'not found..'; echo 'installing..'; fi"
---> Running in 2c47bee97dfc
not found...
installing..
Removing intermediate container 2c47bee97dfc
---> 35e698d1aea6
Successfully built 35e698d1aea6
You have extra spaces in your first command, and shouldn't be using a variable name with a dollar sign at the beginning. I think you probably also don't want to be assigning that with $(), since you haven't tested if it exists yet. Trying to run a command to see if it exists also isn't a great way to go about it. You can see if a program is installed like this:
if ! command -v gcc &> /dev/null; then
opkg install gcc
fi
(That's POSIX-compatible so should work in ash.)
You could also run opkg list-installed and check the output (see the docs) which may be useful for packages that aren't executables in your PATH.
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).
I use php:7.3.2-cli-alpine3.9 as my base image. I also need SSHFS installed inside container since PHP library I use relies on it. I know there are many answers with "if you install SSHFS inside container you are doing it wrong" but in my case I need this software installed inside container not on host.
In my Dockerfile I have
RUN apk update && apk add sshfs;
This command is executed without errors:
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
v3.9.3-21-g265a28802e [http://dl-cdn.alpinelinux.org/alpine/v3.9/main]
v3.9.3-15-g583c0d55e9 [http://dl-cdn.alpinelinux.org/alpine/v3.9/community]
OK: 9764 distinct packages available
(1/12) Installing openssh-keygen (7.9_p1-r4)
(2/12) Installing openssh-client (7.9_p1-r4)
(3/12) Installing fuse-common (3.2.6-r1)
(4/12) Installing fuse3 (3.2.6-r1)
(5/12) Installing libffi (3.2.1-r6)
(6/12) Installing libintl (0.19.8.1-r4)
(7/12) Installing libuuid (2.33-r0)
(8/12) Installing libblkid (2.33-r0)
(9/12) Installing libmount (2.33-r0)
(10/12) Installing pcre (8.42-r1)
(11/12) Installing glib (2.58.1-r2)
(12/12) Installing sshfs (3.5.1-r0)
Executing busybox-1.29.3-r10.trigger
Executing glib-2.58.1-r2.trigger
OK: 25 MiB in 44 packages
But when I am trying to mount remote host
'/usr/bin/sshfs' -C -o reconnect -o 'Port=22' -o 'UserKnownHostsFile=/ssh/known_hosts' -o StrictHostKeyChecking=yes -o 'IdentityFile=/ssh/<FILE>' -o PasswordAuthentication=no '<USER>#<HOST>:/' '/fuse/'
I am getting:
fuse: device not found, try 'modprobe fuse' first
When I am running it I am getting:
modprobe: can't change directory to '/lib/modules': No such file or directory
Am I missing any packages? What else needs to be installed?
Thanks.
In order to run SSHFS inside container it requires privileged permissions.
Install SSHFS by adding this line in Dockerfile:
RUN apk update && apk add sshfs;
Run container:
docker run --privileged=true -it --rm --name alpine-app transfers-image
I installed openstack magnum (ocata release) on docker in my controller node because I have installed newton on my host machines and newton binaries did not install correctly but now when I try to run magnum-service list command the output is:
ERROR: Unable to establish connection to http://controller:9511/v1/mservices
then I checked both magnum-api and magnum-conductor logs and there was an error:
ERROR magnum ImportError: No module named profiler
then I tried:
su -s /bin/sh -c "/var/lib/magnum/env/bin/pip install profiler" magnum
but even after installing profiler the error was the same.
Can anyone help?
Tnx to #eandersson now both services are running successfully but I faced another problem and that is when I try to run:
magnum service-list
The result is:
ERROR: 'errors'
So I tried:
magnum --debug service-list
And the result was:
ERROR: 'NoneType' object has no attribute 'replace' (HTTP 500) (Request-ID: req-cbe3a389-1cea-49f6-8472-3275696a67e3)
You are probably missing osprofiler, not profiler
profiler = importutils.try_import("osprofiler.profiler")
profiler_initializer = importutils.try_import("osprofiler.initializer")
profiler_web = importutils.try_import("osprofiler.web")
Try installing it instead.
su -s /bin/sh -c "/var/lib/magnum/env/bin/pip install osprofiler" magnum
By the way, when pip installing something for OpenStack you should be applying the requirements constrains.
-c https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata
So ideally your command would look like this.
su -s /bin/sh -c "/var/lib/magnum/env/bin/pip install -c https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata osprofiler" magnum
I want to create a project from dockerfile. Firstly, I should clone a framework from github and install it.
In my Dockerfile I have the following instrutions:
RUN git clone https://github.com/simgrid/project.git
WORKDIR "/project"
RUN cmake option1 options2 .
RUN sudo make
RUN sudo make install
I build image with:
docker build -t "myimage" .
But I have an error about text file busy. How can I overcome it?
make[2]: execvp: /simgrid/tools/sg_unit_extractor.pl: Text file busy
make[2]: *** [src/cunit_unit.cpp] Error 127
CMakeFiles/testall.dir/build.make:69: recipe for target 'src/cunit_unit.cpp' failed
CMakeFiles/Makefile2:616: recipe for target 'CMakeFiles/testall.dir/all' failed
make[1]: *** [CMakeFiles/testall.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c sudo make' returned a non-zero code: 2
My Dockerfile content is:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y \
sudo \
git \
build-essential \
cmake \
libboost-dev \
libboost-all-dev \
doxygen \
python3
RUN git clone https://github.com/simgrid/simgrid.git
WORKDIR "/simgrid"
RUN cmake -Denable_documentation=OFF -Denable_coverage=OFF -Denable_java=OFF -Denable_model-checking=OFF \
-Denable_lua=OFF -Denable_compile_optimizations=OFF -Denable_smpi=OFF -Denable_smpi_MPICH3_testsuite=OFF -Denable_compile_warnings=OFF .
RUN sudo make
RUN sudo make install
The error message you are seeing is from the output of make. It does not appear be an error for Docker. Instead, this points back to the code being compiled inside the image and so you would want to raise this issue with them in github.
I do see a fair number of kernel and network components being compiled with the app, which may not properly function in a docker sandbox, and so the code you are trying to compile may not be able to run in this type of isolation without disabling some of the protections that docker provides. See docker's security documentation for more details, particularly on the namespaces, cgroups, and capabilities to protect the kernel.
Despite this is not a Docker issue there are some scenarios where you can face this error building a dockerfile.
Just to bring a known workaround (even if it is not the most elegant solution) let me show you this one.
In my case I got the message " Text file busy " when trying to build a Dockerfile with the following line:
RUN chmod 500 /build/build_dotcms.sh && /build/build_dotcms.sh ${BUILD_FROM} ${BUILD_ID}
Provoked an interruption with "Text file busy" intermitently.
The workaround was to add a "sleep 1" between chmod command and shell script execution
RUN chmod 500 /build/build_dotcms.sh && sleep 1 && /build/build_dotcms.sh ${BUILD_FROM} ${BUILD_ID}
I found the solution in a github thread: https://github.com/moby/moby/issues/9547
Hope it helps.