I want to install pg_stat_monitor extension in Dockerfile. I found this article https://pgxn.org/dist/pg_stat_monitor/. Prepared this step in the Dockerfile
RUN git clone https://github.com/percona/pg_stat_monitor \
&& cd /build/pg_stat_monitor \
&& make USE_PGXS=1 \
&& make USE_PGXS=1 install
No, I get this error
---> Running in baece8df47d0
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
clone (no such package):
required by: .fetch-deps-20220504.193645[clone]
https://github.com/percona/pg_stat_monitor (no such package):
required by: .fetch-deps-20220504.193645[https://github.com/percona/pg_stat_monitor]
Could you please help me install this extension inside the docker container. Thanks.
Related
I'm running a flutter app on a raspberry pi 4, I'm using flutter-pi. Everything works fine, but I want to take it to a higher level.
I want to encapsulate the app and all flutter-pi dependencies in a docker container.
I am using the ubuntu:jammy image as a base, I have installed all the dependencies according to flutter-pi.
When I run the app I get this error:
[locales] Warning: The system has no configured locale. The default "C" locale may or may not be supported by the app.
[keyboard] Could not load keyboard configuration from "/etc/default/keyboard". Default keyboard config will be used. load_file: No such file or directory
[flutter-pi] Could not query DRM device list: No such file or directory
NOTE: the raspberry is configured to do a console auto login and does not have a graphical interface
I have developed a flutter-pi application and encapsulated it in a container.
What I noticed is that this error (Could not query DRM device list: No such file or directory) happens to me only sometimes, the configuration is always the same but sometimes I faced it and some times I didn't.
I'm assuming it is related with the host system in which the docker containers are running, because as I previously said the configuration of the container is always the same in both the working container and the not working one.
I'm attaching down below the configuration of my dockerfile (it's made of 2 dockerfiles but it's only 1 container that I'm running, the second dockerfile uses the first one which is built in emotionsrl/tower-display-base).
The display_launcher.py only runs the flutter (flutter-pi --release ./spotlink_build) after a few checks that are not related with the rest.
FROM ubuntu
RUN apt -y update \
&& apt -y install git \
&& apt -y install wget \
&& apt -y install build-essential
WORKDIR /TOWER_DISPLAY
# STEP 1 DIPENDENZE
RUN git clone --depth 1 \
https://github.com/ardera/flutter-engine-binaries-for-arm.git \
engine-binaries && cd engine-binaries && ./install.sh
# STEP 2 DIPENDENZE
ENV TZ=Europe/Rome
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt -y install cmake \
libgl1-mesa-dev \
libgles2-mesa-dev \
libegl1-mesa-dev \
libdrm-dev \
libgbm-dev
RUN DEBIAN_FRONTEND='noninteractive' apt -y install ttf-mscorefonts-installer
RUN apt -y install fontconfig \
libsystemd-dev \
libinput-dev \
libudev-dev \
libxkbcommon-dev
#STEP 3 DIPENDENZE
RUN fc-cache
###########################
# COMPILING
RUN git clone https://github.com/ardera/flutter-pi
WORKDIR /TOWER_DISPLAY/flutter-pi/build
RUN cmake ..
RUN make -j `nproc`
RUN make install
FROM emotionsrl/tower-display-base
WORKDIR /TOWER_DISPLAY
COPY spotlink_build ./spotlink_build
COPY display_launcher.py ./display_launcher.py
CMD python3 ./display_launcher.py
Im trying to setup an external library in a SwiftPM Package project. This package (Mockingbird) is only used from within my test target, and therefor my main application target does not depend on this.
On my MacOS host machine, building and executing this test target works perfectly fine. No errors whatsoever.
However, i'm also building this application within a dockerized container within a CI process. Im using the official swift docker images (swift 5.5) for this.
From within this docker container, building the main target itself works fine, because it does not depends on the Mockingbird lib. But building the test target fails when compiling mockingbird.
When starting this Docker container, i always clean the build folder and resolve the packages first before building the targets.
This is the error im getting:
In file included from /app/.build/checkouts/mockingbird/Sources/MockingbirdFramework/Objective-C/Bridge/sources/MKBTypeFacade.m:1:
/app/.build/checkouts/mockingbird/Sources/MockingbirdFramework/Objective-C/Bridge/sources/../include/MKBTypeFacade.h:1:9: fatal error: 'Foundation/Foundation.h' file not found
#import <Foundation/Foundation.h>
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /app/.build/checkouts/mockingbird/Sources/MockingbirdFramework/Objective-C/Bridge/sources/MKBTestExpectation.m:1:
/app/.build/checkouts/mockingbird/Sources/MockingbirdFramework/Objective-C/Bridge/sources/../include/MKBTestExpectation.h:1:9: fatal error: 'XCTest/XCTest.h' file not found
#import <XCTest/XCTest.h>
^~~~~~~~~~~~~~~~~
/app/.build/checkouts/mockingbird/Sources/MockingbirdFramework/Objective-C/Bridge/sources/MKBTestUtils.m:1:
/app/.build/checkouts/mockingbird/Sources/MockingbirdFramework/Objective-C/Bridge/sources/../include/MKBTestUtils.h:1:9: fatal error: 'Foundation/Foundation.h' file not found
#import <Foundation/Foundation.h>
^~~~~~~~~~~~~~~~~~~~~~~~~
/app/.build/checkouts/mockingbird/Sources/MockingbirdFramework/Objective-C/Bridge/sources/MKBMocking.m:1:
/app/.build/checkouts/mockingbird/Sources/MockingbirdFramework/Objective-C/Bridge/sources/../include/MKBMocking.h:1:9: fatal error: 'Foundation/Foundation.h' file not found
#import <Foundation/Foundation.h>
Maybe im missing out on something?
Thanks in advance!
Edit 1: Added dockerfile
FROM swift:5.6.2-focal
WORKDIR /app
RUN apt-get update \
&& apt-get install openssh-client lcov -y
ARG INSTALL_COMMANDS="echo \"No custom install commands provided, proceeding\""
RUN ${INSTALL_COMMANDS}
ARG GITLAB_SSH_PRIVATE_KEY
RUN mkdir -p ~/.ssh \
&& echo "${GITLAB_SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa \
&& chmod 0600 ~/.ssh/id_rsa \
&& eval "$(ssh-agent -s)" \
&& ssh-add ~/.ssh/id_rsa \
&& ssh-keyscan ${GIT_URL} > ~/.ssh/known_hosts
## Copy entire repo into container
COPY ./Package.* ./
RUN swift package resolve
COPY . .
## Remove SSH keys
RUN rm -rf /root/.ssh/
After my image was created containing the source files, i run it like:
docker run ${IMAGE_NAME} \
/bin/sh -c "swift build --target AppTests"
I want to make a Dockerfile to build an image of Postgres:11 that already installed postgresql-hll extension inside.
Im not experienced with Docker so Im have no idea to follow the instruction of installing this extension properly.
In order to do this you need to:
clone the git repository:
git clone https://github.com/citusdata/postgresql-hll.git
Create a file called Dockerfile (at the same level with the folder postgresql-hll created at step 1) with the contents:
ARG psversion=11
FROM postgres:$psversion
COPY postgresql-hll /postgresql-hll
RUN apt-get update -y && apt-get install -y postgresql-server-dev-${PG_MAJOR} make gcc g++
WORKDIR /postgresql-hll
RUN PG_CONFIG=/usr/bin/pg_config make
RUN PG_CONFIG=/usr/bin/pg_config make install
RUN echo "shared_preload_libraries = 'hll'" >> /usr/share/postgresql/postgresql.conf.sample
COPY create_extension.sql /docker-entrypoint-initdb.d/
Create a file create_extension.sql at the same level with the Dockerfile, with the contents:
CREATE EXTENSION hll;
Build your image:
# build for POSTGRES 11
docker build -t hll:1.0 --build-arg psversion=11 .
# build for POSTGRES 9.6
docker build -t hll:1.0 --build-arg psversion=9 .
NOTE: The version for POSTGRES 9.6 gives an error when trying to load the library. It is here for completeness and maybe somebody can contribute to fix it.
Run a container based on this image
docker run -d --name hll hll:1.0
Open a shell in the newly created container:
docker exec -ti hll bash
Inside the container run:
su postgres
psql
\dx
The output should show the hll extension as installed.
I try to add the plpython3 extension to my timescaledb/postgres (based on linux alpine) image:
FROM timescale/timescaledb:0.9.0-pg10
RUN set -ex \
&& apk add --no-cache --virtual .plpython3-deps --repository http://nl.alpinelinux.org/alpine/edge/testing \
postgresql-plpython3
When I try to create the extension I get the following error:
postgres=# CREATE EXTENSION plpython3u;
ERROR: could not open extension control file "/usr/local/share/postgresql/extension/plpython3u.control": No such file or directory
But when I search for the files inside my container I can find them within a different directory:
/ # find / -name '*plpy*'
/usr/lib/postgresql/plpython3.so
/usr/share/postgresql/extension/plpython3u.control
/usr/share/postgresql/extension/plpython3u--1.0.sql
/usr/share/postgresql/extension/plpython3u--unpackaged--1.0.sql
How can I install postgresql-plpython3 to a different directory or configure postgres to recognize my added extension?
Update
When I just mv the files to /usr/local/share/postgresql/extension I get the error:
postgres=# CREATE EXTENSION plpython3u;
ERROR: could not access file "$libdir/plpython3": No such file or directory
Update 2
So the issue with $libdir was that pg_config --pkglibdir points to /usr/local/lib/postgresql but plpython3.so is inside /usr/lib/postgresql. When I move everything to the according /usr/local directories I can successfully create the extension.
This leads to the question where I hope to find an answer. How can I install postgresql-plpython3 to /usr/local/... instead of /usr/...?
I am fairly certain that if you use prebuilt packages you are stuck with hardcoded installation paths.
The easiest way around your problem is to create symlinks after installation:
FROM timescale/timescaledb:0.9.0-pg10
RUN set -ex \
&& apk add --no-cache --virtual .plpython3-deps --repository http://nl.alpinelinux.org/alpine/edge/testing \
postgresql-plpython3 \
&& ln -s /usr/lib/postgresql/plpython3.so /usr/local/lib/postgresql/plpython3.so \
&& ln -s /usr/share/postgresql/extension/plpython3u.control /usr/local/share/postgresql/extension/plpython3u.control \
&& ln -s /usr/share/postgresql/extension/plpython3u--1.0.sql /usr/local/share/postgresql/extension/plpython3u--1.0.sql \
&& ln -s /usr/share/postgresql/extension/plpython3u--unpackaged--1.0.sql /usr/local/share/postgresql/extension/plpython3u--unpackaged--1.0.sql
I have tried to build slate using Docker, but modified changes are not affected when i compile the source. in my source path I have below files.
Dockerfile
FROM debian:latest
MAINTAINER Fed
VOLUME /usr/src/app/source
EXPOSE 4567
RUN apt-get update && \
apt-get install -y ruby git ruby-dev make gcc zlib1g-dev nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN gem install bundler
RUN git clone https://github.com/tripit/slate.git /slate
WORKDIR "/slate"
RUN bundle install
CMD ["bundle", "exec", "middleman", "server", "--force-polling"]
docker-compose.yml
slate:
build: .
ports:
- 4567:4567
volumes:
- ./source:/slate/source
- ./build:/slate/build
Makefile
.PHONY: build
build:
docker-compose build
up:
docker-compose up
compile:
docker-compose run slate bundle exec middleman build --clean
When I tried make compile output shows
docker-compose run slate bundle exec middleman build --clean
create build/stylesheets/screen.css
create build/stylesheets/print.css
create build/images/navbar.png
create build/images/logo.png
create build/fonts/slate.svg
create build/fonts/slate.woff
create build/fonts/slate.woff2
create build/fonts/slate.ttf
create build/fonts/slate.eot
create build/javascripts/all.js
create build/javascripts/all_nosearch.js
create build/index.html
Project built successfully
and when I execute make build
docker-compose build
Building slate
Step 1 : FROM debian:latest
---> 1b088884749b
Step 2 : MAINTAINER Fed
---> Using cache
---> f36ba5d1e018
Step 3 : VOLUME /usr/src/app/source
---> Using cache
---> d97292401c69
Step 4 : EXPOSE 4567
---> Using cache
---> 5ae0ecc71451
Step 5 : RUN apt-get update && apt-get install -y ruby git ruby-dev make gcc zlib1g-dev nodejs && apt-get clean && rm -rf /var/lib/apt/lists/*
---> Using cache
---> c83e099e40ee
Step 6 : RUN gem install bundler
---> Using cache
---> 4cc13ce89152
Step 7 : RUN git clone https://github.com/tripit/slate.git /slate
---> Using cache
---> 1ec325b7dc6b
Step 8 : WORKDIR "/slate"
---> Using cache
---> 8cc73cafc405
Step 9 : RUN bundle install
---> Using cache
---> 150ed469b196
Step 10 : CMD bundle exec middleman server --force-polling
---> Using cache
---> 9c2142617887
Successfully built 9c2142617887
and when I execute make up
docker-compose up
Starting docs_slate_1
Attaching to docs_slate_1
slate_1 | == The Middleman is loading
slate_1 | == View your site at "http://localhost:4567", "http://127.0.0.1:4567"
slate_1 | == Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
but when I go to browser(http://192.168.99.100:4567/- boot2docker ip) and check then it will shows original slate installation not my modified changes i have done to index.html.md file in source folder. The build folder in my path also have not been updated.
anyone can identify What i have done wrong here? I'm new to Docker.
Thanks.
Try this: docker-compose up --build