You are not logged in.
Pages: 1
When I try to build this Dockerfile:
FROM python:3.12
RUN apt update && apt install -y gcc libpq-dev
RUN pip install sqlalchemy psycopg2 nicegui
WORKDIR /app
ADD *.py .
ENTRYPOINT ["python3", "/app/main.py"]
I get this error:
=> ERROR [2/5] RUN apt update && apt install -y gcc libpq-dev 2.6s
------
> [2/5] RUN apt update && apt install -y gcc libpq-dev:
0.265
0.265 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.265
0.350 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
0.397 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
0.414 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
0.451 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8789 kB]
0.915 Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [2468 B]
0.916 Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [204 kB]
1.649 Fetched 9250 kB in 1s (6787 kB/s)
1.649 Reading package lists...
1.991 Building dependency tree...
2.058 Reading state information...
2.066 2 packages can be upgraded. Run 'apt list --upgradable' to see them.
2.069
2.069 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2.069
2.070 Reading package lists...
2.422 Building dependency tree...
2.500 Reading state information...
2.585 gcc is already the newest version (4:12.2.0-3).
2.585 Suggested packages:
2.585 postgresql-doc-15
2.598 The following packages will be upgraded:
2.599 libpq-dev libpq5
2.605 Killed
------
Dockerfile:3
--------------------
1 | FROM python:3.12
2 |
3 | >>> RUN apt update && apt install -y gcc libpq-dev
4 | RUN pip install sqlalchemy psycopg2 nicegui
5 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apt update && apt install -y gcc libpq-dev" did not complete successfully: exit code: 137
I do not think this is a memory issue, as the system RAM usage does not increase when running the build.
I am running docker from the normal repos, not docker-desktop.
I have tried running the apt-get commands one after the other instead of chaining, and the crash always happens when installing libpq-dev.
Last edited by JoMaZu787 (2024-11-21 15:51:37)
Offline
apt? Debian-bookworm repository? You might be in the wrong help forum, @JoMaZu787... You're on Arch Linux, correct - and not, say, Ubuntu or Mint or MX or Debian? If so, those other distros have lovely forums full of lovely people who would be much better equipped to handle this issue than we are.
Last edited by ratemisia (2024-11-17 03:31:44)
Offline
The apt-get command is being run in the container, which is based on Debian. I am running Arch.
Last edited by JoMaZu787 (2024-11-17 11:10:26)
Offline
exit code: 137 still means the process gets sigkill'ed - the reasons for that are most likely OOM or timeout, so try to raise the docker memory limit and timeout into the absurd and see which one mitigates that step.
Offline
I've tried
docker build --memory 8G app
but it gives the same error, and I'm not sure how to change the timeout, if there is any.
Offline
Not the --memory parameter, see https://stackoverflow.com/a/45468671
Edit: also https://wiki.archlinux.org/title/Docker … ds_too_low in case the quotas there are too strict)
Last edited by seth (2024-11-17 16:12:57)
Offline
The answers in the linked stackoverflow question appear to be either irrelevant (referring to running in a vm with limited memory or on docker desktop) or say there is no limit (in the case of Javier Castellanos' answer).
I've tried removing the process limit like you suggested, with no change in the results.
Offline
I am running docker from the normal repos, not docker-desktop.I am running docker from the normal repos, not docker-desktop.
'key…
and the crash always happens when installing libpq-dev.
2.598 The following packages will be upgraded:
2.599 libpq-dev libpq5
What if you structure
RUN sleep 30
RUN apt update
RUN apt install -y gcc
RUN sleep 30
RUN apt install -y libpq5
RUN apt install -y libpq-dev
Offline
docker build app
[+] Building 64.5s (10/14) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 284B 0.0s
=> [internal] load metadata for docker.io/library/python:3.12 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [ 1/10] FROM docker.io/library/python:3.12 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 29B 0.0s
=> [ 2/10] RUN sleep 30 30.3s
=> [ 3/10] RUN apt update 2.2s
=> [ 4/10] RUN apt install -y gcc 0.7s
=> [ 5/10] RUN sleep 30 30.4s
=> ERROR [ 6/10] RUN apt install -y libpq5 0.9s
------
> [ 6/10] RUN apt install -y libpq5:
0.401
0.401 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.401
0.404 Reading package lists...
0.741 Building dependency tree...
0.815 Reading state information...
0.886 The following additional packages will be installed:
0.886 libpq-dev
0.887 Suggested packages:
0.887 postgresql-doc-15
0.898 The following packages will be upgraded:
0.898 libpq-dev libpq5
0.902 Killed
------
Dockerfile:7
--------------------
5 | RUN apt install -y gcc
6 | RUN sleep 30
7 | >>> RUN apt install -y libpq5
8 | RUN apt install -y libpq-dev
9 | RUN pip install sqlalchemy psycopg2 nicegui
--------------------
ERROR: failed to solve: process "/bin/sh -c apt install -y libpq5" did not complete successfully: exit code: 137
same issue, but with the libpq5 command
Offline
It's probably been libpq5 all along?
If you remove the sleeps, does the failure move into libpq-dev?
Can you install postgresql-doc-15 ?
Offline
If you remove the sleeps, does the failure move into libpq-dev?
No, but I've noticed that libpq-dev and libpq5 depend on each other, so I don't think it's possible to separate which one is causing the issue.
Can you install postgresql-doc-15 ?
I tried but...
docker build app
[+] Building 1.1s (8/13) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 295B 0.0s
=> [internal] load metadata for docker.io/library/python:3.12 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 29B 0.0s
=> [1/9] FROM docker.io/library/python:3.12 0.0s
=> CACHED [2/9] RUN apt update 0.0s
=> CACHED [3/9] RUN apt install -y gcc 0.0s
=> ERROR [4/9] RUN apt install -y postgresql-doc-15 1.1s
------
> [4/9] RUN apt install -y postgresql-doc-15:
0.278
0.278 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.278
0.280 Reading package lists...
0.745 Building dependency tree...
0.915 Reading state information...
1.046 The following additional packages will be installed:
1.046 libpq-dev libpq5
1.061 The following NEW packages will be installed:
1.061 postgresql-doc-15
1.061 The following packages will be upgraded:
1.061 libpq-dev libpq5
1.065 Killed
------
Dockerfile:5
--------------------
3 | RUN apt update
4 | RUN apt install -y gcc
5 | >>> RUN apt install -y postgresql-doc-15
6 | RUN apt install -y libpq5
7 | RUN apt install -y libpq-dev
--------------------
ERROR: failed to solve: process "/bin/sh -c apt install -y postgresql-doc-15" did not complete successfully: exit code: 137
...same issue, it pulls in libpq5 and libpq-dev as dependencies. (Looking at the Ubuntu Package Search it looks like postgresql-doc-15 only needs libpq5, but that pulls in libpq-dev because that's just the headers for libpq5)
EDIT: Forgot to clear cache, but it gives the same result with --no-cache
Last edited by JoMaZu787 (2024-11-18 20:45:04)
Offline
https://packages.debian.org/bookworm/libpq5 doesn't seem to depend on https://packages.debian.org/bookworm/libpq-dev and https://packages.debian.org/bookworm/postgresql-doc-15 doesn't have any deps at all?
6 | RUN apt install -y libpq5
7 | RUN apt install -y libpq-dev
You're dragging that in, but though the idea was to check whether you can install "just" postgresql-doc-15 it doesn't seem so.
What if you skip gcc and install just and only libpq5 ?
Edit: hold on
Looking at the Ubuntu Package Search it looks like postgresql-doc-15
No ubuntu release seems to ship -15 at all, how does ubuntu come into this mix?
Last edited by seth (2024-11-19 07:37:08)
Offline
Did you set up any "security" measurements or docker settings? This looks like the docker daemon kills the container.
Offline
No ubuntu release seems to ship -15 at all, how does ubuntu come into this mix?
Sorry, got that mixed up, Ubuntu has nothing to do with this
Offline
What if you skip gcc and install just and only libpq5 ?
Basically the question is whether you run into some limit at some point.
Offline
What if you skip gcc and install just and only libpq5 ?
docker build app --no-cache
[+] Building 2.9s (7/10) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 206B 0.0s
=> [internal] load metadata for docker.io/library/python:3.12 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 29B 0.0s
=> CACHED [1/6] FROM docker.io/library/python:3.12 0.0s
=> [2/6] RUN apt update 2.1s
=> ERROR [3/6] RUN apt install -y libpq5 0.9s
------
> [3/6] RUN apt install -y libpq5:
0.364
0.364 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.364
0.365 Reading package lists...
0.697 Building dependency tree...
0.764 Reading state information...
0.829 The following additional packages will be installed:
0.829 libpq-dev
0.830 Suggested packages:
0.830 postgresql-doc-15
0.841 The following packages will be upgraded:
0.841 libpq-dev libpq5
0.844 Killed
------
Dockerfile:4
--------------------
2 |
3 | RUN apt update
4 | >>> RUN apt install -y libpq5
5 | RUN pip install sqlalchemy psycopg2 nicegui
6 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apt install -y libpq5" did not complete successfully: exit code: 137
still the same thing happening
Offline
this issue seems to be around since 2015
from several issues I read this seems to be a version mismatch
can you please add a
--verbose-versions
to see if libpq5 matches libpq-dev
Online
> [3/6] RUN apt install -y libpq5 --verbose-versions:
0.334
0.334 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.334
0.336 Reading package lists...
0.693 Building dependency tree...
0.774 Reading state information...
0.864 The following additional packages will be installed:
0.865 libpq-dev (15.9-0+deb12u1)
0.866 Suggested packages:
0.866 postgresql-doc-15 (15.9-0+deb12u1)
0.879 The following packages will be upgraded:
0.879 libpq-dev (15.8-0+deb12u1 => 15.9-0+deb12u1)
0.880 libpq5 (15.8-0+deb12u1 => 15.9-0+deb12u1)
0.885 Killed
same version
Offline
Since you're starting with a "python:3.12" image, you should be wary of what they've "done" to the Debian image. Is there a reason you're not calling "dist-upgrade" after the "update"? I would also recommend pulling a specific O/S tagged version of Python, e.g. "python:3.12-bookworm", or, alternatively, if you're adding a large amount of packages, instead switch to a Debian image and add Python instead of the other way around.
Offline
Solved the issue by using the psycopg-binary pip module instead of psycopg so that i don't need the libpq debian packages
Offline
Pages: 1