is it possible to install postgresql-dev in bullseye - postgresql

Now I am using rust:1.54-bullseye as my base image, when I run my app it shows error:./reddwarf_music: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory, I searching from internet and someone told that install postgresql-devel would fix this problem .now I tried to install postgresql-devel in the base image using this command:
RUN apt install postgresql-devel
but it tell me:
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package postgresql-devel
The command '/bin/sh -c apt install postgresql-devel' returned a non-zero code: 100
exit status 100
Error: exit status 100
what should I do to install this package in rust:1.54-bullseye? I have already tried this way:
RUN apt-get update && apt-get install postgresql-devel
install postgresql-devel failed, could not find the package.

Tried this command to install the libpq.so.5 dependencies:
RUN apt-get update && apt-get install postgresql -y
works. It will install dependencies but the postgresql still too large, the better way is install libpq5 like this:
RUN apt-get update && apt-get install libpq5 -y

Perhaps the best is to use docker-compose with a better segreation of responsibility.
docker-compose.yml
version: '2'
services:
app:
image: rust:1.54-bullseye
depends_on:
- db
environment:
- DB_HOSTNAME=db
- DB_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- bullseye-data:/var/lib/bullseye/db
networks:
- bullseye
db:
image: postgres
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_DB=bullseye
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- bullseye-database:/var/lib/postgresql/data
networks:
- bullseye
volumes:
bullseye-database:
bullseye-data:
networks:
bullseye:

Related

ERROR when installing subprocces cffi during docker-compose installation

I am currently coding my .gitlab-ci.yml to setup the CI/CD of my project.But when the pipeline runs I get an ERROR during the installation of my docker-compose.#
My .gitlab-ci.yml file
image: docker:stable
stages:
- deploy
services:
- docker:dind
variables:
DOCKER_CLIENT_TIMEOUT: 240
COMPOSE_HTTP_TIMEOUT: 240
before_script:
- apk add python3 py3-pip
- python3 -m pip install --upgrade pip setuptools wheel
- pip3 install dxlmispservice
- pip3 install setuptools-rust
- pip3 install docker-compose
The Log of the Pipeline
Building wheel for PyYAML (pyproject.toml): started
Building wheel for PyYAML (pyproject.toml): finished with status 'done'
Created wheel for PyYAML: filename=PyYAML-5.4.1-cp38-cp38-linux_x86_64.whl size=45656 sha256=9de5adf1f8c62bc5c5b9da385015c331f5c6100035a7de96c1ffab4ad2ec2eb2
Stored in directory: /root/.cache/pip/wheels/dd/c5/1d/5d7436173d3efd4a14dcb510eb0b29525ecb6b0e41489e716e
Building wheel for cffi (setup.py): started
Building wheel for cffi (setup.py): finished with status 'error'
error: subprocess-exited-with-error

Error in openshift standard_init_linux.go:219: exec user process caused: no such file or directory

I am running 90 microservices in openshift and few of the services are in CrashLoopBackOff and logs showing the following error message.
Error:
OC logs -f :
"standard_init_linux.go:219: exec user process caused: no such file or directory"
OC Describe:
Is there an issue with the image because describe output shows:
"Container image "IMAGE_TAG" already present on machine"
Due to the fact that there is lack of information -
it is impossible to say exactly where the problem is.
I have found some similar errors.
Here is one of the best solutions that matches description of your problem:
Here the key to solve the problem was replacing the aronautica crate via rust-argon2 and modifying the Dockerfile:
FROM rust AS build
WORKDIR /usr/src
RUN apt-get update && apt-get upgrade -y && apt-get install -y build-essential git clang llvm-dev libclang-dev libssl-dev pkg-config libpq-dev brotli
RUN USER=root cargo new loxe-api WORKDIR /usr/src/loxe-api COPY
Cargo.toml Cargo.lock ./ COPY data ./data COPY migrations ./migrations
RUN cargo build --release
# Copy the source and build the application. COPY src ./src ENV PKG_CONFIG_ALLOW_CROSS=1 ENV
OPENSSL_INCLUDE_DIR="/usr/include/openssl" RUN cargo install --path .
FROM debian:buster-slim COPY --from=build
/usr/local/cargo/bin/loxe-api .
# standard env COPY .env ./.env COPY data ./data COPY migrations ./migrations RUN apt-get update && apt-get install -y libssl-dev
pkg-config libpq-dev brotli CMD ["/loxe-api"] ```
See also this similar issues:
second one
third one

How to install mongodb database tools in a Dockerfile?

Pretty much the question. Here's what I have currently:
FROM node:15 as server
WORKDIR /app
ENV NODE_ENV=production
COPY server/package.json ./
RUN npm install
COPY server/ ./
RUN apt-get update
RUN apt-get install -y mongo-tools
EXPOSE 5000
CMD ["node", "src/app.js"]
Which does work however mongo-tools is a really outdated version of the tools and is not fit for my pusposes.
Mongo Docs has instructions for how to install the newer mongodb-database-tools on linux/windows/macos but I can't figure out how to get it to work in a DockerFile.
For anyone wondering, I'm trying to get a node-cron to periodically call mongodump on a mongodb atlas database.
Any help is appreciated :)
you can download newer version of the tools and install it, just like you do on linux host
example Dockerfile like below:
FROM node:15 as server
WORKDIR /app
ENV NODE_ENV=production
RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian92-x86_64-100.3.1.deb && \
apt install ./mongodb-database-tools-*.deb && \
rm -f mongodb-database-tools-*.deb
COPY server/package.json ./
RUN npm install
COPY server/ ./
EXPOSE 5000
CMD ["node", "src/app.js"]

how to install plpython for postgres?

I have postgres image: https://hub.docker.com/_/postgres
I am trying to create the python extension with the following command:
create extension plpythonu
but it fail with the error:
psql:/docker-entrypoint-initdb.d/init.sql:1: ERROR: could not open extension control file "/usr/share/postgresql/12/extension/plpythonu.control": No such file or directory
in my Dockerfile I try to install the package:
FROM postgres
RUN apt-get update -y
RUN apt install postgresql-plpython3-12
I get error:
Unable to locate package postgresql-plpython3-12
How can I extend the postgresql so that I can use python ?
I have found a solution to install plpython3 into my postgres container
FROM postgres
RUN apt-get update
RUN apt-get -y install python3 postgresql-plpython3-12
COPY pg-setup-scripts/init.sql /docker-entrypoint-initdb.d
and then in the entrypoint script
create extension plpython3u;

Not able to run apt-get command for docker image creation

I have centos Machine as a docker host and i was trying to create a container with UBUNTU
my docker compose file in docker host is as following
FROM ubuntu:latest
RUN apt-get install -y git && \
apt-get clean
When i was trying to build the image i am getting the following error
This is the section for building the image
[root#testcent image_creation]# docker build -t ubuntu_git/venkat_ubu_git .
Sending build context to Docker daemon 2.048 kB
Step 1/2 : FROM ubuntu:latest
---> 3556258649b2
Step 2/2 : RUN apt-get install -y git && apt-get clean
---> Running in 6b12dfaed5b8
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package git
The command '/bin/sh -c apt-get install -y git && apt-get clean' returned a non-zero code: 100
[root#testcent image_creation]# </i>
$ Can any one please help me
Normally docker base images won't support directly installing packages without update command. check and try out with the below if it works for you.
RUN apt-get update && apt-get install -y git && apt-get clean