Riofs - fuse device not found - docker

I am trying to run riofs inside a docker container, however when I try to run riofs I get the following error:
fuse: device not found, try 'modprobe fuse' first
ERROR! Failed to mount FUSE partition !
ERROR! Failed to create FUSE fs ! Mount point: /path/to/dir
Here is what my DockerFile looks like:
FROM ubuntu:16.04
RUN apt-get update -qq
RUN apt-get install -y \
build-essential \
gcc \
make \
automake \
autoconf \
libtool \
pkg-config \
intltool \
libglib2.0-dev \
libfuse-dev \
libxml2-dev \
libevent-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
RUN curl -L https://github.com/skoobe/riofs/archive/v${VERSION}.tar.gz | tar zxv -C /usr/src
RUN cd /usr/src/riofs-${VERSION} && ./autogen.sh && ./configure --prefix=/usr && make && make install
WORKDIR /opt/riofs/bin
CMD ["bash"]

I needed to add the runtime privilege SYS_ADMIN because fuse needs permissions to mount/umount.
docker run -it --cap-add SYS_ADMIN --device /dev/fuse [IMAGE] bash

Related

Kartoza Geoserver on Heroku

I am new to docker and not an IT-specialist. I try to install Kartoza Geoserver in Docker on Heroku, but so far no success. Does anyone has experience with this and can explain me the settings in the dockerfile and the steps specifically for a Heroku install?
So far I tried a build with a modified dockerfile but I always get the same error (in the log trail) when opening/launching geoserver on Heroku:
"Error: groupadd: cannot open /etc/group".
I guess it is an permission/privileges issue.
Any sharing of experience on modifying the docker file so that the image is read by Heroku would be helpfull.
Modifying the settings in the dockerfile:
Removed the port forwarding from dockerfile
Add RUN adduser -D myuser USER myuser to dockerfile
Result dockerfile:
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
ARG IMAGE_VERSION=9.0.65-jdk11-openjdk-slim-buster
ARG JAVA_HOME=/usr/local/openjdk-11
FROM tomcat:$IMAGE_VERSION
LABEL maintainer="Tim Sutton<tim#linfiniti.com>"
ARG GS_VERSION=2.22.0
ARG WAR_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip
ARG STABLE_PLUGIN_BASE_URL=https://sourceforge.net/projects/geoserver/files/GeoServer
ARG DOWNLOAD_ALL_STABLE_EXTENSIONS=1
ARG DOWNLOAD_ALL_COMMUNITY_EXTENSIONS=1
ARG HTTPS_PORT=8443
ENV DEBIAN_FRONTEND=noninteractive
#Install extra fonts to use with sld font markers
RUN adduser -D myuser
USER myuser
RUN set -eux; \
apt-get update; \
apt-get -y --no-install-recommends install \
locales gnupg2 wget ca-certificates rpl pwgen software-properties-common iputils-ping \
apt-transport-https curl gettext fonts-cantarell lmodern ttf-aenigma \
ttf-bitstream-vera ttf-sjfonts tv-fonts libapr1-dev libssl-dev \
wget zip unzip curl xsltproc certbot cabextract gettext postgresql-client figlet gosu gdal-bin; \
# Install gdal3 - bullseye doesn't build libgdal-java anymore so we can't upgrade
curl https://deb.meteo.guru/velivole-keyring.asc | apt-key add - \
&& echo "deb https://deb.meteo.guru/debian buster main" > /etc/apt/sources.list.d/meteo.guru.list \
&& apt-get update \
&& apt-get -y --no-install-recommends install gdal-bin libgdal-java; \
dpkg-divert --local --rename --add /sbin/initctl \
&& (echo "Yes, do as I say!" | apt-get remove --force-yes login) \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*; \
# verify that the binary works
gosu nobody true
ENV \
JAVA_HOME=${JAVA_HOME} \
DEBIAN_FRONTEND=noninteractive \
GEOSERVER_DATA_DIR=/opt/geoserver/data_dir \
GDAL_DATA=/usr/share/gdal \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/tomcat/native-jni-lib:/usr/lib/jni:/usr/local/apr/lib:/opt/libjpeg-turbo/lib64:/usr/lib:/usr/lib/x86_64-linux-gnu" \
FOOTPRINTS_DATA_DIR=/opt/footprints_dir \
GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc \
CERT_DIR=/etc/certs \
RANDFILE=/etc/certs/.rnd \
FONTS_DIR=/opt/fonts \
GEOSERVER_HOME=/geoserver \
EXTRA_CONFIG_DIR=/settings \
COMMUNITY_PLUGINS_DIR=/community_plugins \
STABLE_PLUGINS_DIR=/stable_plugins
WORKDIR /scripts
ADD resources /tmp/resources
ADD build_data /build_data
ADD scripts /scripts
RUN echo $GS_VERSION > /scripts/geoserver_version.txt ;\
chmod +x /scripts/*.sh;/scripts/setup.sh \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN echo 'figlet -t "Kartoza Docker GeoServer"' >> ~/.bashrc
WORKDIR ${GEOSERVER_HOME}
ENTRYPOINT ["/bin/bash", "/scripts/entrypoint.sh"]
Then build it with argument --platform linux/amd64 (I use arm64 architecture). Then pushed it to Heroku. All the time I get the same error.

Shiny app (leafviz) in docker container not loading in browser

I am building a docker container to use the Leafcutter and Leafviz analysis tools. The final visualization commanded from an R file uses shiny app, it works fine on my machine but when ran in the container I can't connect to it.
I run the container with the following line of code:
docker run -dit --name leaf --rm -p 1234:1234 leafcutter
All is in order when I check with docker ps:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
783f550df965 leafcutter "bash" 2 minutes ago Up 2 minutes 0.0.0.0:1234->1234/tcp, :::1234->1234/tcp leaf
Executing the pipeline in the container calls several snakefiles, and the last rule of the last one calls the R file:
Rscript /path/to/run_leafviz.R -i {input}
That script calls several functions before calling leafviz() which basically just runs the shiny app, I've modified the options like so:
shiny::runApp(launch.browser=FALSE, appDir = system.file("application", package = "leafviz"), host = "0.0.0.0", port = 1234)
All the shiny files and packages are installed with the R leafviz package. When I execute my container all goes fine, the output shows "Listening on http://0.0.0.0:1234", but when I try to connect I get the "connexion failed" page.
My Dockerfile is fairly large but here are the most relevant parts:
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
#Install Ubuntu packages
RUN apt-get update && apt-get install \
-y cmake -y curl \
-y default-jre \
-y gdebi-core \
-y less -y libarchive13 -y libbz2-dev -y libcairo2-dev -y libcurl4-openssl-dev -y libgsl-dev \
-y liblzma-dev -y libncurses5-dev -y libncursesw5-dev -y libssl-dev -y libxml2-dev -y libxt-dev \
-y pandoc -y pandoc-citeproc -y python-pip \
-y tabix \
-y unzip \
-y wget \
-y zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
#Install conda, snakemake, samtools, regtools...
#[...]
#Install R
LABEL org.label-schema.license="GPL-2.0" \
org.label-schema.vcs-url="https://github.com/rocker-org/r-apt" \
org.label-schema.vendor="Rocker Project" \
maintainer="Dirk Eddelbuettel <edd#debian.org>"
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
littler r-base r-base-dev r-recommended r-cran-docopt
RUN ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
#Install shiny server (I have tried with and without this RUN command)
RUN wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" && \
VERSION=$(cat version.txt) && \
wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
gdebi -n ss-latest.deb && \
rm -f version.txt ss-latest.deb
EXPOSE 1234
#Install R packages
COPY install_packages.R /tmp/install_packages.R
RUN Rscript /tmp/install_packages.R
CMD ["bash"]
I've been learning docker quite chaotically so I don't know if some elements are clashing, but I have exposed the container port and published it to the host and no error message seems to indicate there is a problem coming from somewhere else. I would really appreciate some help.

Sudo not available in docker image despite being installed in base image

I can't access Sudo from my container, despite it looking like the base image has it installed.
nistmni#ca5af2f4aace:~$ sudo echo x
bash: sudo: command not found
nistmni#ca5af2f4aace:~$ /bin/sudo
bash: /bin/sudo: No such file or directory
My Dockerfile is simple:
FROM nistmni/minc-toolkit
RUN mkdir ~/execute
COPY . ~/execute/
CMD /bin/bash
The Dockerfile for nistmni/minc-toolkit is:
FROM ubuntu:xenial
# install basic system packages
RUN apt-get -y update && \
apt-get -y dist-upgrade && \
apt-get install -y --no-install-recommends \
sudo \
build-essential g++ gfortran bc \
bison flex \
libx11-dev x11proto-core-dev \
libxi6 libxi-dev \
libxmu6 libxmu-dev libxmu-headers \
libgl1-mesa-dev libglu1-mesa-dev \
libjpeg-dev \
libssl-dev ccache libapt-inst2.0 git lsb-release \
curl ca-certificates unzip && \
apt-get autoclean && \
rm -rf /var/lib/apt/lists/*
# add user to build all tools
RUN useradd -ms /bin/bash nistmni && \
echo "nistmni ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nistmni && \
chmod 0440 /etc/sudoers.d/nistmni
ENV PATH=/usr/lib/ccache:$PATH
# add new cmake
RUN mkdir src && \
cd src && \
curl -L --output cmake-3.14.5.tar.gz https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5.tar.gz && \
tar zxf cmake-3.14.5.tar.gz && \
cd cmake-3.14.5 && \
./configure --prefix=/usr --no-qt-gui && \
make && \
make install && \
cd ../../ && \
rm -rf src
USER nistmni
ENV HOME /home/nistmni
WORKDIR /home/nistmni
Is this:
Some subtlety of base images I don't understand
Sudo is getting removed somewhere I'm not seeing
Not actually the Dockerfile being used to create the image
Thanks.

How to get an X11 socket connection between a docker container and the desktop

I wish to run Pycharm community within Docker on my desktop. I have created a Dockerfile (below) and seen it work fine on Mac.
FROM debian:buster-slim
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
apt-utils \
dirmngr \
gnupg \
libasound2 \
libdbus-glib-1-2 \
libgtk-3-0 \
libxrender1 \
libx11-xcb-dev \
libx11-xcb1 \
libxt6 \
xz-utils \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
ENV HOME /home/user
RUN useradd --create-home --home-dir $HOME user \
&& chown -R user:user $HOME
ENV LANG C.UTF-8
RUN apt-get update && \
apt-get install -y python-pip \
vim \
wget \
x11-utils \
xfonts-base \
xpra
# install PyCharm
RUN cd / && \
wget -q http://download.jetbrains.com/python/pycharm-community-2019.1.1.tar.gz && \
tar xvfz pycharm-community-2019.1.1.tar.gz && \
rm pycharm-community-2019.1.1.tar.gz
USER user
CMD [ "/pycharm-community-2019.1.1/bin/pycharm.sh"]
However when I try to run this on Ubuntu I get X11 errors from the Pycharm code:
Start Failed: Failed to initialize graphics environment
java.awt.AWTError: Can't connect to X11 window server using ':1' as
the value of the DISPLAY variable. at
java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
The command to invoke the container is:
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=${DISPLAY} <<image_id>>
I have tried many variations on the DISPLAY var (eg unix$DISPLAY), but none have worked.
Update:
I ran:
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=${DISPLAY} --entrypoint /bin/sh <<image_id>>
to get access into the container, and then ran:
$ ls -l /tmp
total 0
I am confused - I thought the X11 socket residing in my host machine would have been bound to the same location in the container. Is this a red-herring?

How to expose port from host to container in Docker?

You can use EXPOSE in Docker for:
The EXPOSE instructions informs Docker that the container will listen
on the specified network ports at runtime.
Can I do the opposite? Can I expose port from my Ubuntu to the docker container?
Background: I'm trying to setup a simple php7-fpm as a docker image and I would like to expose port 3306 (MySQL service) to the docker container.
My Dockerfile:
FROM debian:jessie
# persistent / runtime deps
RUN apt-get update && apt-get install -y ca-certificates curl libpcre3 librecode0 libsqlite3-0 libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
# phpize deps
RUN apt-get update && apt-get install -y autoconf file g++ gcc libc-dev make pkg-config re2c --no-install-recommends && rm -r /var/lib/apt/lists/*
ENV PHP_INI_DIR /usr/local/etc/php
RUN mkdir -p $PHP_INI_DIR/conf.d
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
##</autogenerated>##
ENV PHP_VERSION 7.0.0RC2
# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself)
RUN buildDeps=" \
$PHP_EXTRA_BUILD_DEPS \
libcurl4-openssl-dev \
libpcre3-dev \
libreadline6-dev \
librecode-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
xz-utils \
" \
&& set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SL "https://downloads.php.net/~ab/php-$PHP_VERSION.tar.xz" -o php.tar.xz \
&& mkdir -p /usr/src/php \
&& tar -xof php.tar.xz -C /usr/src/php --strip-components=1 \
&& rm php.tar.xz* \
&& cd /usr/src/php \
&& ./configure \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
$PHP_EXTRA_CONFIGURE_ARGS \
--disable-cgi \
--enable-mysqlnd \
--with-pdo-mysql \
--enable-mbstring \
--with-curl \
--with-openssl \
--with-pcre \
--with-readline \
--with-recode \
--with-zlib \
&& make -j"$(nproc)" \
&& make install \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \
&& make clean
COPY docker-php-ext-* /usr/local/bin/
##<autogenerated>##
WORKDIR /var/www/html
COPY php-fpm.conf /usr/local/etc/
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##
This is the command I use to run my container:
docker run --name=php7-fpm -v /var/www/html/:/var/www/html/ -p 9002:9000 marty/php7
My PHP app database configuration:
database:
main:
host: 127.0.0.1
dbname: edu
user: root
password: myPassword
port: 3306
You can run container with --net=host then it will have access to the host's ports directly. See https://docs.docker.com/engine/reference/run/#network-settings

Resources