Install specific version of python in Dockerfile on ubuntu - docker

I have this in a Dockerfile:
RUN apt install -y python3-pip
how do I install a specific version of python though? Something like this:
RUN apt install -y python3-pip#python===3.6.7
I am looking for:
Python 3.6.7

If you want to install latest version just use RUN apt-get install python3 but if you want to install specific version of python you should do it manually for example were going to install python3.5.1:
sudo apt-get install libssl-dev openssl
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
tar xzvf Python-3.5.1.tgz
cd Python-3.5.1
./configure
make
sudo make install
After installation completed set installed python as default one.

If you just want to install a specific version of Python over a simple Ubuntu, then why don't you directly use the official Python image corresponding to your needs ?
You can find all the supported images here : https://hub.docker.com/_/python

Related

How to install a bookworm package from a bullseye docker image

I'm currently building images from python:3.9-slim-bullseye.
I also need the latest version of libleptonica-dev which is only available for bookworm and sid.
Currently, if I run apt-get install -y libleptonica-dev in my Dockerfile, it's installing the 1.79, but I need the 1.82.
Is there a way to install a package from a future debian version even if bullseye-backport doesn't exist ?
IN order to install libleptonica-dev version 1.82 from bookworm in Debian bullseye open the terminal and type:
sudo apt update
wget -c http://ftp.us.debian.org/debian/pool/main/l/leptonlib/libleptonica-dev_1.82.0-3+b2_amd64.deb
sudo apt install ./libleptonica-dev_1.82.0-3+b2_amd64.deb

How do I install tesseract-ocr v4.1.1 in a docker image

I'm trying to build a docker image that will run on WSL-2 Ubuntu-20.04 (hosted on Windows 10).
I need to install the version 4.1.1 of tesseract-ocr, which according to https://ubuntu.pkgs.org/20.04/ubuntu-universe-arm64/tesseract-ocr_4.1.1-2build2_arm64.deb.html is 4.1.1-2build2. This line should work:
RUN apt-get update && apt-get install tesseract-ocr -y
But it installs V 4.0.0. So, I tried this line:
RUN apt-get update && apt-get install tesseract-ocr=4.1.1-2build2 -y
which gives me this error:
Version '4.1.1-2build2' for 'tesseract-ocr' was not found
Any suggestions would be greatly appreciated.

Install GDAL Library in Docker Container

I'm trying to install GDAL in a docker container running the CVAT tool. The base docker file can be found here https://github.com/openvinotoolkit/cvat/blob/develop/Dockerfile . I modified it to add GDAL using several recommended ways but always seems to run into errors.
This is the current modification I made in the dockerfile for GDAL which still fails.
# Install GDAL
RUN apt-get update
RUN apt-get install -y software-properties-common && apt-get update
RUN add-apt-repository ppa:ubuntugis/ppa && apt-get update
RUN apt-get install -y gdal-bin libgdal-dev libpq-dev
ARG CPLUS_INCLUDE_PATH=/usr/include/gdal
ARG C_INCLUDE_PATH=/usr/include/gdal
RUN pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
I also tried adding a specific version of GDAL in the requirements file (https://github.com/openvinotoolkit/cvat/blob/develop/cvat/requirements/base.txt) but it still fails while building GDAL.
How do I install GDAL so that I can run some CRS conversions inside the docker container?
Update: For now just CRS conversions but in the future I need to handle some raster tasks as well so I would prefer to import the full GDAL module.

Install Java runtime in Debian based docker image

I am trying to install the java runtime in a Debian based docker image (mcr.microsoft.com/dotnet/core/sdk:3.1-buster). According to various howtos this should be possible by running
RUN apt update
RUN apt-get install openjdk-11-jre
The latter command comes back with
E: Unable to locate package openjdk-11-jre
However according to https://packages.debian.org/buster/openjdk-11-jre the package does exist. What am I doing wrong?
Unsure from which image your are pulling. I used slim, Dockerfile.
from debian:buster-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man2
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-11-jre
# Prints installed java version, just for checking
RUN java --version
NOTE: If you don't run the mkdir -p /usr/share/man/man1 /usr/share/man/man2 you'll run into dependency problems with ca-certificates, openjdk-11-jre-headless etc. I've been using this fix provided by community, haven't really checked the permanent fix.

Can ejabberd be installed on Google Compute Engine?

Can ejabberd be installed on Google Compute Engine? Will there be any issues with using ejabberd on Compute Engine? I have looked but cannot find any references to anyone trying this before. Grateful for any help.
Yes. Compute Engine gives you VMs. You can put whatever you want on them, such as Erlang and ejabberd.
Yes you can.
You can use the Vm with Debian Image and follow this intructions.
http://www.howtoforge.com/virtual-mail-jabber-server-xmpp-with-iredmail-and-ejabberd-on-ubuntu-9.10
dont forget open the ports in the firewall.
Sorry I didn't have much time to put together a cleaner "how to". I just copied and pasted from my personal archive.
Here's what you'd have to do to compile the source code on a Compute Engine. Please let me know if you have any questions.
Image: debian-7-wheezy-v20140408
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libncurses5-dev
sudo apt-get install openssl libssl-dev
sudo apt-get install libexpat1-dev
sudo apt-get install unixodbc-dev
wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
tar tar -xvzf yaml-0.1.5.tar.gz
cd yaml-0.1.5
./configure
sudo make
sudo make install
sudo apt-get install xsltproc
sudo apt-get install fop
cd ..
wget http://www.erlang.org/download/otp_src_R16B03-1.tar.gz
gunzip -c otp_src_R16B03-1.tar.gz | tar -xf -
cd o....
./configure --with-odbc=/usr/lib/odbc
sudo make
sudo make install
[.. Install git and clone repo here.. ]
git clone git#github.com:processone/ejabberd.git
cd ejabberd
./configure --enable-odbc --enable-mysql
sudo make
sudo make install

Resources