Compile docker-grafana-graphite on Windows - docker

Trying to complete this tutorial to run grafana on Windows, at this point of compilation I kept got this error:
PS C:\Programs\Others\LocustReport\docker-grafana-graphite> make up
mkdir -p \
data/whisper \
data/elasticsearch \
data/grafana \
log/graphite \
log/graphite/webapp \
log/elasticsearch
The syntax of the command is incorrect.
make: *** [prep] Error 1
PS C:\Programs\Others\LocustReport\docker-grafana-graphite>
Please any workaorund to get it compiled?

You'll need to run a linux vm (I use virtualbox) to build the image on.

Related

Self hosted GitHub Action Runner jobs failing

We make use of Github Self-Hosted action runners running on EC2 machines (m5.xlarge). We use these as part of our CI/CD pipeline to support docker image builds and automated testing. This solution has worked fine for the last year or so, but all of a sudden yesterday, the builds started to fail with the following error message :
time="2023-02-03T12:00:13Z" level=error msg="error waiting for container: unexpected EOF"
My understanding of this is that it is typically due to docker containers running out of resources (CPU / Memory Limit) being hit but given that these are m5.xlarges (4 vCPU and 16GB Memory) I'm a little surprised. Our builds make use of NPM which I understand can be quite resource hungry but monitoring a container during its execution showed that it was nowhere near the limits of the node:
I've tried to cycle the nodes but there is no difference in behaviour. The following user-data script is used with these nodes which connects it to our Github account and makes it available for jobs. I've also tried using the latest actions-runneer package, but again, no change in behaviour. What other reasons could this error be thrown for as i'm a bit stumped by this.
#!/bin/sh
set -e
curl https://get.docker.com | bash
apt install -y python3-pip jq
pip3 install awscli
mkdir actions-runner && cd actions-runner
curl -O -L https://github.com/actions/runner/releases/download/v2.286.0/actions-runner-linux-x64-2.286.0.tar.gz
tar xzf ./actions-runner-linux-x64-2.286.0.tar.gz
chown -R ubuntu:ubuntu .
instance_id="$(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
url="https://api.github.com/orgs/<REMOVED>/actions/runners/registration-token"
token=$(curl -s -u "<REMOVED>:<REMOVED>" -X POST "$url" | jq -r .token)
sudo -u ubuntu ./config.sh \
--name "products-stage-ec2-runner-$instance_id" \
--token "$token" \
--url "https://github.com/<REMOVED>" \
--labels "<REMOVED>" \
--unattended
sudo ./svc.sh install
sudo ./svc.sh start
See details on my comment of how I resolved this.

Build fails during make of OpenCV on Raspberry Pi with "segmentation fault" caused by "cc1plus"

I'm trying to make a build of OpenCV 4.0.0 on my Raspberry Pi 3B+, and keep running into this issue:
[ 83%] Building CXX object modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o
c++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
modules/stitching/CMakeFiles/opencv_perf_stitching.dir/build.make:62: recipe for target 'modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o' failed
make[2]: *** [modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o] Error 4
CMakeFiles/Makefile2:23142: recipe for target 'modules/stitching/CMakeFiles/opencv_perf_stitching.dir/all' failed
make[1]: *** [modules/stitching/CMakeFiles/opencv_perf_stitching.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
This is the make/build portion of the script I'm running:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=~/.virtualenvs/py3cv4/bin/python \
-D WITH_GSTREAMER=ON \
-D WITH_FFMPEG=ON \
-D WITH_OPENMP=ON \
-D BUILD_EXAMPLES=ON ..
echo ""
echo "======================="
echo "Building OpenCV..."
make -j4
sudo make install
sudo ldconfig
I read somewhere that I should change the make -j4 command to not use all four cores, because I'm running out of memory. I tried make -j1, but still got the same error at the same spot. I'm going to try again with just plain make, but delete all the pre-built stuff that's in there and start over from scratch to see if that helps.
Turns out I needed to entirely delete the build I had created and rebuild it with a single core instead of all four, as it was using up too much memory. I deleted my /opencv/build/ directory and then did make with no -j command, and it worked fine. It took a really long time (5+ hours), but it did complete successfully. Now I just have to figure out why I can't import cv2...

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

Docker build error: failed to add the host

I'm facing an unexpected error when running docker build, and I say unexpected because I haven't changed my Dockerfile for a while, and it had worked fine for the last time two weeks ago, but now I'm getting the following error:
failed to create endpoint optimistic_spence on network bridge: failed to add the host (veth9fc3a03) <=> sandbox (veth15abfd6) pair interfaces: operation not supported
In case it is of any help:
Docker version is 18.06.0-ce, build 0ffa8257ec
I don't see any container with docker ps
Systemd returns an active status for the docker process (sudo systemctl status docker)
Build command is: docker build -t user/repo:tag .
Dockerfile looks like:
FROM alpine:3.4
LABEL version="current version"
LABEL description="A nice description."
LABEL maintainer="my#email.com"
RUN apk update && apk add \
gcc \
g++ \
make \
git \
&& git clone https://gitlab.com/user/repo.git \
&& cd repo \
&& make \
&& cp program /bin \
&& rm -r /repo \
&& apk del g++ make git
WORKDIR /tmp
ENTRYPOINT ["program"]
Does anybody understand what is going on? Thank you!
EDIT
When combined with the --network option, the error changes a little, but it won't fix the problem. For example, --network=host gives the following:
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.4/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.167438ca.tar.gz: No such file or directory
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.4/community: temporary error (try again later)
WARNING: Ignoring APKINDEX.a2e6dac0.tar.gz: No such file or directory
2 errors; 11 distinct packages available
The command '/bin/sh -c apk update && apk add gcc g++ make git && git clone https://gitlab.com/user/repo.git && cd repo && make && cp program /bin && rm -r /repo && apk del g++ make git' returned a non-zero code: 2
Had the same error and systemctl restart docker nor pruning og images & system did not do it for me, I ended up rebooting my computer which seems o have resolved the issue.
It looks that something wrong happened with any docker network bridge and it doesn't let you to create the same because is "zombie".
Try with following steps:
docker network prune, and if it doesn't work, try with:
docker system prune <-- Careful, this also will purge your named volumes contents, i.e, volumes that are not assigned to a container. So, if you have volumes assigned to a container, you should have to re-build/create containers.
/etc/init.d/docker restart
Show me what happens and let's see, actually I need more info about your problem if it doesn't solve it to you.
Two times I have faced this issue and the way to fix it has always been the same. I'm posting in case it can be of any help for somebody:
First, make sure that the DNS server is properly set up (eg. setting DNS to 1.1.1.1).
Second, restarting the docker daemon.
For those using systemd in Linux, systemctl restart did not the job for me. I had to stop and start docker to make it work. After that, I could login and pull images again.

"dockerfile" text file busy

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.

Resources