Dockerfile microdnf -y install fuse-devel throws error - fuse

I am using registry.access.redhat.com/ubi8/ubi-minimal:8.6-854 image and
RUN microdnf -y install fuse-devel throws error.
---> Running in bc463d8592cb
error: No package matches 'fuse-devel'
The command '/bin/sh -c microdnf -y install fuse-devel' returned a non-zero code: 1
make: *** [Makefile:196: build-fuse-binary] Error 1
Couldnt find a doc on how to install this dependency using microdnf
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6-854
ADD register-sys.sh /usr/bin/
RUN microdnf update --setopt=tsflags=nodocs && \
microdnf install -y --nodocs hostname subscription-manager
RUN microdnf update --setopt=tsflags=nodocs && \
microdnf install -y gcc libstdc++-devel \
gcc-c++ fuse curl-devel \
libxml2-devel openssl-devel mailcap \
git automake make
RUN microdnf -y install fuse-devel

Related

Dockerfile for Python3 and OpenCV

I need to have a Dockerfile with Python3 and the latest version of OpenCV. The Dockerfile I have written is described below:
FROM ubuntu
#Install OpenCV
RUN apt-get update &&\
apt-get install -y cmake
RUN apt-get install -y gcc g++
RUN apt-get install -y python3-dev python3-numpy
# To support GUI features
RUN apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
# To support GTK 2
RUN apt-get install -y libgtk2.0-dev
# To support GTK 3
RUN apt-get install -y libgtk-3-dev
#Optional dependencies
RUN apt-get install -y libpng-dev
RUN apt-get install -y libjpeg-dev
RUN apt-get install -y libopenexr-dev
RUN apt-get install -y libtiff-dev
RUN apt-get install -y libwebp-dev
# Clone OpenCV repo
RUN apt-get install -y git
RUN git clone https://github.com/opencv/opencv.git
#Compile
RUN mkdir /opencv/build && \
cd /opencv/build
RUN cmake ..
RUN make
However, when i run it, it gives me the following error with cmake.
Step 17/27 : RUN cmake ..
---> Running in 3dca32df2036
CMake Error: The source directory "/" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
The command '/bin/sh -c cmake ..' returned a non-zero code: 1
Do you know what am i doing wrong?
You just need to chain the last RUN instructions:
#Compile
RUN mkdir /opencv/build && \
cd /opencv/build && \
cmake .. && \
make
Explanation:
A RUN statement creates a new image layer and executes the specified shell command. This means that each RUN statement will run the command in a separate shell, so the current directory from the previous RUN will not be preserved (you can see that the CMake current directory is / by looking closely at the error message).
You can find more info about RUN statement in the Docker documentation and I also recommend reading Best practices for writing Dockerfiles.

Install python 3.5 inside docker with a base image centos7

I am trying to install python 3.5 inside docker with a base image centos7. This is our Dockerfile
FROM base-centos7:0.0.8
# Install basic tools
RUN yum install -y which vim wget git gcc
# Install python 3.5
RUN yum install -y https://repo.ius.io/ius-release-el7.rpm \
&& yum update -y \
&& yum install -y python35u python35u-libs python35u-devel python35u-pip
RUN python3.5 -m pip install --upgrade pip
But during the build, docker build image is failing with the following errors
executor failed running [/bin/sh -c yum install -y https://repo.ius.io/ius-release-el7.rpm
&& yum update -y
&& sudo yum install -y python35u python35u-libs python35u-devel python35u-pip]: exit code: 127.
Can anyone guide me in resolving this issue. and why am I seeing this issue in very first place.
You can use python image from docker hub
https://hub.docker.com/_/python
Example of dockerfile :
FROM python:3.6
RUN mkdir /code
WORKDIR /code
ADD . /code/
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python", "/code/app.py"]
i think it's easy , isn't ?
the centos repo uses:
FROM centos/s2i-base-centos7
EXPOSE 8080
ENV PYTHON_VERSION=3.5 \
PATH=$HOME/.local/bin/:$PATH \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8 \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
PIP_NO_CACHE_DIR=off
RUN INSTALL_PKGS="rh-python35 rh-python35-python-devel rh-python35-python-setuptools rh-python35-python-pip nss_wrapper \
httpd24 httpd24-httpd-devel httpd24-mod_ssl httpd24-mod_auth_kerb httpd24-mod_ldap \
httpd24-mod_session atlas-devel gcc-gfortran libffi-devel libtool-ltdl enchant" && \
yum install -y centos-release-scl && \
yum -y --setopt=tsflags=nodocs install --enablerepo=centosplus $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
# Remove centos-logos (httpd dependency) to keep image size smaller.
rpm -e --nodeps centos-logos && \
yum -y clean all --enablerepo='*'
source here
The problem is not difficult, I build the image changing
FROM base-centos7:0.0.8 ====> FROM centos:7
You can consult the images version of centos in https://hub.docker.com/_/centos
PD: The container showed: errro exited(1), you should focus on the main process.

yum in dockerfile - There are no enabled repos

I am having issues with installing python3 with yum in dockerfile. I did look on internet, I did try few things, not working. Its just small thing but not able to figure it out. When I try to build below docker file I do get error . I get error at line -
RUN yum install -y oracle-epel-release-el7
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>
The docker file is below.
FROM openjdk:13-jdk-slim
ARG MAVEN_VERSION=3.6.3
ARG USER_HOME_DIR="/root"
ARG SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
# Install prerequisites
RUN apt-get update && apt-get install -y curl
RUN apt-get update && apt-get install -y yum
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
# Install Python 3.6
RUN yum install -y oracle-epel-release-el7
RUN yum install -y python36
# Install AWS CLI
RUN pip3 install awscli
CMD ["/bin/bash"]
Why mix apt and yum? You're already using apt-get, just use it to install your python too:
apt-get install python3.6

Cannot install pyodbc in docker and getting error command 'gcc' failed with exit status 1

I'm trying install pyodbc in docker running inside linux container
But I'm getting the following error
Click here to view the image
src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
#include <sql.h>
^~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyodbc
Here is my dockerfile
FROM mcr.microsoft.com/azure-functions/python:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY . /home/site/wwwroot
FROM ubuntu
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install gcc mono-mcs && \
rm -rf /var/lib/apt/lists/*
FROM python
RUN apt-get update && apt-get install -y python3-pip
# RUN /usr/bin/pip -r /home/site/wwwroot/requirements.txt
# WORKDIR /home/site/wwwroot
COPY --from=0 /home/site/wwwroot /home/site/wwwroot
RUN cd /home/site/wwwroot && pip install -r requirements.txt
Note: I'm going push the code to the azure functionapp in linux machine
I had the same issue, I added the below code in my docker file, and it started working. Microsoft docker image is missing unixodbc-dev, so you need to install separately using the below command.
RUN apt-get update && apt-get install -y --no-install-recommends \
unixodbc-dev \
unixodbc \
libpq-dev
This is the setup that worked for me:
# pull official base image
FROM python:3.9.2-slim-buster
# install system dependencies
RUN apt-get update \
&& apt-get -y install gcc \
&& apt-get -y install g++ \
&& apt-get -y install unixodbc unixodbc-dev \
&& apt-get clean
And the pyodbc package was installed successfully.
The error is:
src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
#include <sql.h>
This is telling you that you are missing a file sql.h. Looking at the documentation for PyODBC, it appears to require the UnixODBC development environment.
There are installation instructions at the above link for most major distributions. You will need to update your Dockerfile to install the unixodbc-dev package.
This link is also helpful, you are missing mandatory files to needed to install. Add the below command for Debain to Dockerfile , the link has all solutions
RUN apt-get update && apt-get install -y gcc unixodbc-dev
https://github.com/mkleehammer/pyodbc/issues/165
The consolidated list of dependencies needed for pyodbc can be found in the documentation. Make sure all of these are installed.
PYODBC installation documentation

How to run pdfkit from_file in a Docker container

The following is my code for Docker:
FROM python:3.6.2-jessie
## Prepare apt-get:
RUN echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections && \
apt-get update -qy && \
apt-get upgrade -qy && \
apt-get clean autoclean && \
apt-get install wkhtmltopdf -y && \
apt-get autoremove -y && \
apt-get install python3-setuptools -qy &&\
apt-get install python3-dev -qy && \
apt-get install python3-pip -qy && \
apt-get install build-essential -qy && \
apt-get -y install openssh-client -qy && \
apt-get clean
RUN pip3 install --upgrade pip
RUN pip3 install pandas
RUN pip3 install psycopg2==2.7.3.2
RUN pip3 install pdfkit
When I run following code,
docker run my_image python3 pdfkit.py
I get the following error:
OSError: wkhtmltopdf exited with non-zero code -6. error: The switch
--viewport-size, is not support using unpatched qt, and will be ignored.The switch --disable-smart-shrinking, is not support using
unpatched qt, and will be ignored.QXcbConnection: Could not connect to
display
Try the following:
RUN curl -L#o wk.tar.xz https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \
&& tar xf wk.tar.xz \
&& cp wkhtmltox/bin/wkhtmltopdf /usr/bin \
&& cp wkhtmltox/bin/wkhtmltoimage /usr/bin \
&& rm wk.tar.xz \
&& rm -r wkhtmltox
Rather than installing directly using apt-get install wkhtmltopdf -y.

Resources