Closed brunohadlich closed 3 years ago
It may be the case that auto-updating from v2.5 to v3.0 is problematic. Am I correct in interpreting your compose file as using bind mounts to a local filesystem? If you initial first with the v2.5 image, the initialization will create the database in the local filesystem, and when you run with the v3.0 image afterward without clearing out the database that was created during v2.5 initialization, the v3.0 container will attempt to use the existing database.
I am binding container foldder /var/lib/postgresql/data/
to my computer folder ./postgresql/data/
, but the following steps were executed before starting the container:
docker-compose down && docker system prune
sudo rm -rf ./postgresql/data/
sudo mkdir ./postgres/data
This clean up was executed before starting both, 2.5 and 3.0.
For testing purposes, can you remove the bind mounts and see if initialization works without specifying volumes?
You might also test to see if you can simply start a container using docker directly. Try these:
docker container run --rm -it --name two -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres postgis/postgis:12-2.5
docker container run --rm -it --name three -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres postgis/postgis:12-3.0
@brunohadlich :
Hello, could you give us more details about about your environment?
{ host os | docker | docker-compose } version?
my personal experience
docker-compose
versions ...I am using similar test case like you ; based on postgis:12-3.0
image + docker-compose version: '2'
config + local volume ..without any problems ( except the docker-compose
revert )
my dev environment on ubuntu 20.04
user@host:~$ docker-compose -v
docker-compose version 1.26.2, build eefe0d31
user@host:~$ docker version
Client: Docker Engine - Community
Version: 19.03.13
API version: 1.40
Go version: go1.13.15
Git commit: 4484c46d9d
Built: Wed Sep 16 17:02:52 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.13
API version: 1.40 (minimum version 1.12)
Go version: go1.13.15
Git commit: 4484c46d9d
Built: Wed Sep 16 17:01:20 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.3.7
GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
@phillipross removing networks and volumes did not work but the command docker container run --rm -it --name three -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres postgis/postgis:12-3.0
worked. It is really strange that running without docker-compose has worked, maybe what @ImreSamu said about docker-compose version is right as I am using docker-compose 1.27.2.
@ImreSamu I am running Ubuntu 20.04.1 LTS over Microsoft WSL 2, here is docker and docker-compose versions:
bruno@DESKTOP-1HGLI35:~/git/raw-backend$ docker-compose -v
docker-compose version 1.27.2, build 18f557f9
bruno@DESKTOP-1HGLI35:~/git/raw-backend$ docker version
Client: Docker Engine - Community
Azure integration 0.1.15
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:45:36 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:49:27 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
I found out my issue, before using postgis
I was using postgres
, my service memory was limited to 128MB
, apparently this is not enough for postgis, increasing memory limit to 256MB
did the initialization to work. So after all it was not a problem with versions but a settings constraint.
Glad to see you got it worked out, interesting to see the minimum memory required is 256MB, and also glad to see it wasn't docker-compose's fault 😉
The minimum memory requirement of 256MB
only applies to postgis/postgis:12-3.0
, with postgis/postgis:12-2.5
it is possible to run with 128MB
, that is why only postgis/postgis:12-3.0
was failing to me.
I realized that while
postgis:12-2.5
initialization runs flawlessly, the same does not apply topostgis:12-3.0
. Although the issue seems to reside in initdb-postgis.sh, both files in 2.5 and 3.0 are identical. Both images were downloaded in 9/23/2020.This is my service on docker-compose.yml:
And here is the log from first initialization:
When I only change the image to
postgis/postgis:12-2.5
it works fine like below: