I am using the following command in the dockerfile to install poppler
RUN wget --directory-prefix=~ poppler.freedesktop.org/poppler-22.04.0.tar.xz -O /tmp/poppler-22.04.0.tar.xz && apt-get install xz-utils && tar xf /tmp/poppler-22.04.0.tar.xz -C /tmp && cd /tmp/poppler-22.04.0 && ls && mkdir build && cd build && apt-get -y install libfreetype6-dev && apt-get -y install pkg-config && apt-get -y install libfontconfig1-dev && apt-get -y install libjpeg-dev && apt-get -y install libopenjp2-7-dev && apt-get -y install build-essential cmake && cmake -DENABLE_BOOST=OFF .. && make && make install
When I exec inside the container and do
pdftocairo -v
it says command not found. However when I do
pdftotext -v
I get the following output
pdftotext version 22.04.0
Copyright 2005-2022 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011, 2022 Glyph & Cog, LLC
Was expecting something similar for pdftocairo also as I need the library to convert pdf files to jpeg images. Can someone explain why this is happening ?
Related
We found 1 vulnerability in base docker image "pyjwt version 2.3.0 has 1 vulnerability" Fixed in version pyjwt 2.4.0
Below is the Dockerfile
FROM ubuntu:22.04
# hadolint ignore=DL3015
# hadolint ignore=DL3008
RUN apt-get clean
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update
RUN apt-get -y upgrade apt \
&& apt-get install -y unoconv ghostscript software-properties-common \
&& add-apt-repository ppa:ondrej/php -y \
&& apt -y install php7.4 \
&& apt-get install -y curl jq php7.4-bcmath php7.4-xml zip unzip php7.4-zip \
&& apt-get install -y php7.4-fpm php7.4-amqp composer nginx openssl php7.4-curl ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm awscliv2.zip
# Setup services
COPY ./src/scripts/nginx.conf /etc/nginx/nginx.conf
COPY ./src/scripts/run.sh /opt/run.sh
RUN chmod -R a+rw /etc/nginx
RUN chmod -R a+rw /etc/php/7.4/fpm
RUN chmod +x /opt/run.sh
EXPOSE 8080 8443
CMD [ "/opt/run.sh" ]
I have tried many things like update installing python3 and updating pyjwt package with pip install pyjwt==2.4.0. But it didn't work. It seems like one of the above package from Dockerfile is using pyjwt(2.3.0) and I don't know how do i update it.
You can try uninstall python3-jwt package with apt and install new version with pip
RUN apt purge --autoremove python3-jwt -y
RUN pip3 install PyJWT==2.4.0
I have specific requirement to install Python 2.7.5 in Ubuntu, I could install 2.7.18 without any issues
Below is my dockerfile
ARG UBUNTU_VERSION=18.04
FROM ubuntu:$UBUNTU_VERSION
RUN apt-get update -y \
&& apt-get install -y python2.7.x \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["python"]
however if I set it to python2.7.5
ARG UBUNTU_VERSION=18.04
FROM ubuntu:$UBUNTU_VERSION
RUN apt-get update -y \
&& apt-get install -y python2.7.5 \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["python"]
it is throwing the following error
E: Couldn't find any package by regex 'python2.7.5'
I want to install Python 2.7.5 along with relevant PIP, what should I do?
This version is no longer available in canonical mirrors.
It has been released in 2013.
As a result, having both python and pip working together since then is challenging.
Python 2.7.5 + PIP on centos7
It may be the simplest way if ubuntu is not a requirement.
ARG CENTOS_VERSION=7
FROM centos:$CENTOS_VERSION
# Python 2.7.5 is installed with centos7 image
# Add repository for PIP
RUN yum install -y epel-release
# Install pip
RUN yum install -y python-pip
RUN python --version
ENTRYPOINT [ "python" ]
Python 2.7.5 on ubuntu
I've been able to install it from source
It has not been a success to install pip :
https://bootstrap.pypa.io/pip/2.7/get-pip.py
ARG UBUNTU_VERSION=18.04
FROM ubuntu:$UBUNTU_VERSION
ARG PYTHON_VERSION=2.7.5
# Install dependencies
# PIP - openssl version > 1.1 may be an issue (try older ubuntu images)
RUN apt-get update \
&& apt-get install -y wget gcc make openssl libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev \
&& apt-get clean
WORKDIR /tmp/
# Build Python from source
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \
&& tar --extract -f Python-$PYTHON_VERSION.tgz \
&& cd ./Python-$PYTHON_VERSION/ \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make && make install \
&& cd ../ \
&& rm -r ./Python-$PYTHON_VERSION*
RUN python --version
ENTRYPOINT [ "python" ]
Python 2.7.6 + pip on ubuntu
Ubuntu 14.04 still has mirrors working (how long ???).
Python packages are really close to your expectations.
You may try to run your scripts with that one.
ARG UBUNTU_VERSION=14.04
FROM ubuntu:$UBUNTU_VERSION
RUN apt-get update \
&& apt-get install -y python python-pip \
&& apt-get clean
RUN python --version
ENTRYPOINT [ "python" ]
Python 2.7.5 + pip, not working but could on ubuntu
Here is what I've tried with no success.
ARG UBUNTU_VERSION=16.04
FROM ubuntu:$UBUNTU_VERSION
# Install dependencies
RUN apt-get update \
&& apt-get install -y wget gcc make openssl libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev \
&& apt-get clean
WORKDIR /tmp/
# Build python from source
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \
&& tar --extract -f Python-$PYTHON_VERSION.tgz \
&& cd ./Python-$PYTHON_VERSION/ \
&& ./configure --enable-optimizations --prefix=/usr/local \
&& make && make install \
&& cd ../ \
&& rm -r ./Python-$PYTHON_VERSION*
# Build pip from source
RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py \
&& python get-pip.py
RUN python --version
ENTRYPOINT [ "python" ]
Python 2.7.9 with pip - as requested in comment
You can use this dockerfile, building python includes pip.
ARG UBUNTU_VERSION=16.04
FROM ubuntu:$UBUNTU_VERSION
ARG PYTHON_VERSION=2.7.9
# Install dependencies
RUN apt-get update \
&& apt-get install -y wget gcc make openssl libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev \
&& apt-get clean
WORKDIR /tmp/
# Build Python from source
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \
&& tar --extract -f Python-$PYTHON_VERSION.tgz \
&& cd ./Python-$PYTHON_VERSION/ \
&& ./configure --with-ensurepip=install --enable-optimizations --prefix=/usr/local \
&& make && make install \
&& cd ../ \
&& rm -r ./Python-$PYTHON_VERSION*
RUN python --version \
&& pip --version
ENTRYPOINT [ "python" ]
The simplest possible solution:
sudo apt-get install libssl-dev openssl
wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
tar xzvf Python-2.7.5.tgz
cd Python-2.7.5
./configure
make
sudo make install
After installation completed set installed python as default one.
Below is my docker file
FROM ubuntu:latest
RUN apt-get update -y
RUN apt-get update && apt-get install -y telnet && apt-get install -y ksh && apt-get install -y curl && apt-get install -y python2.7.x python-dev build-essential && apt-get -y clean && rm -rf /var/lib/apt/lists/*
RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
RUN python get-pip.py
RUN pip install pymssql==2.1.3
ENTRYPOINT ['py']
I am getting the below error (py not found in docker image)
I tried replacing 'py' with 'python' and still it complains that 'python' not found in docker image
in the entrypoint command you must use double quote like this:
ENTRYPOINT ["py"]
How do I install R version 3.4.0 in my docker image. I've installed python using:
RUN yum -y install https://centos6.iuscommunity.org/ius-release.rpm \
&& yum -y install python36u \
&& yum -y install python36u-devel \
&& yum -y install python36u-pip \
&& yum -y install python36u-tkinter.x86_64
Similarly I need to install R:
I've specified following things in file so far for R:
ENV R_BASE_VERSION 3.4.0
RUN Rscript -e 'install.packages("devtools",dependencies=TRUE)' \
&&Rscript -e 'install.packages("methods",dependencies=TRUE)' \
&&Rscript -e 'install.packages("jsonlite",dependencies=TRUE)' \
Please suggest .I'm new to docker
I think I need to do something like below:
ENV R_BASE_VERSION 3.4.1
## Now install R and littler, and create a link for littler in /usr/local/bin
## Also set a default CRAN repo, and make sure littler knows about it too
RUN apt-get update \
&& apt-get install -t unstable -y --no-install-recommends \
littler \
r-cran-littler \
r-base=${R_BASE_VERSION}* \
r-base-dev=${R_BASE_VERSION}* \
r-recommended=${R_BASE_VERSION}* \
&& echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site \
&& echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r \
&& ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
But I do not know what is this litter and all. I just need R to be installed and then i will install required packages as I have specified above.
Edits : First line in my docker file installs node4.
Here are two DockerFile to install Python, R and NodeJS
The first one installs Python 3.4.2, R 3.1.1 and nodejs 4.8.4:
From node:4
RUN apt-get update && apt-get remove -y python && apt-get install -y python3 r-base
RUN cp /usr/bin/python3 /usr/bin/python
This second one installs Python 3.5.3, R 3.4.1 and nodejs 4.8.4:
From r-base:3.4.1
RUN apt-get update && apt-get install -y python3 nodejs
RUN cp /usr/bin/python3 /usr/bin/python
Choose the one that best fits your needs.
If your public base image (the base image of your own image) is really node:4, then it is not yum based but apt-get based to manage packages.
Thus you shoud install R the following way:
RUN apt-get update && apt-get install -y r-base
You should use some R images, like
https://hub.docker.com/_/r-base/
or some oher image in this list
https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q=R&starCount=0
I was using the Dockerfile mentioned below to install packages of python, mongodb and tomcaton Centos6.
FROM centos:centos6
RUN yum install -y centos-release-scl && \
yum install python27 &&
echo -e "[mongodb-org-3.2]\nname=MongoDB Repository\nbaseurl==https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/\ngpgcheck=1\nenabled=1\ngpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc" > /etc/yum.repos.d/mongodb-org.repo && \
yum install -y mongodb-org && \
yum install -y tomcat6
CMD ["/bin/bash"]
I was getting the error below
Your transaction was saved, rerun it with:
yum load-transaction /tmp/yum_save_tx-2016-12-16-05-51EmkBfY.yumtx
The command
/bin/sh -c yum install -y centos-release-scl && yum install python27 && echo -e "[mongodb-org-3.2]\nname=MongoDB Repository\nbaseurl==https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/\ngpgcheck=1\nenabled=1\ngpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc" > /etc/yum.repos.d/mongodb-org.repo && yum install -y mongodb-org && yum install -y tomcat6
returned a non-zero code: 1
Not sure what would be the possible problem?
Use the following dockerfile:
FROM centos:centos6
RUN yum install -y centos-release-scl && \
yum install -y python27 && \
echo -e "[mongodb-org-3.2]\nname=MongoDB Repository\nbaseurl==https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/\ngpgcheck=1\nenabled=1\ngpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc" > /etc/yum.repos.d/mongodb-org.repo && \
yum install -y mongodb-org && \
yum install -y tomcat6
CMD ["/bin/bash"]
You were missing -y before python27 and \ after python27 &&.