Above mentioned, is the error I am getting while running my postgres service among other services in my compose.yaml
file.
To let you know the change I made,
I just changed the version from postgres:14 to postgres:15.
I have created volume called postgres-data and it was existing since I was using postgres 14.
<code>volumes:
postgres-data:
name: postgres-data
pgadmin-data:
name: pgadmin-data
</code>
<code>volumes:
postgres-data:
name: postgres-data
pgadmin-data:
name: pgadmin-data
</code>
volumes:
postgres-data:
name: postgres-data
pgadmin-data:
name: pgadmin-data
This is how it is defined currently (only change was from 14 to 15)
<code> postgres:
container_name: postgres
image: postgres:15
expose:
- 5432
volumes:
- postgres-data:/var/lib/postgresql/data
- ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
</code>
<code> postgres:
container_name: postgres
image: postgres:15
expose:
- 5432
volumes:
- postgres-data:/var/lib/postgresql/data
- ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
</code>
postgres:
container_name: postgres
image: postgres:15
expose:
- 5432
volumes:
- postgres-data:/var/lib/postgresql/data
- ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
My question is, what is the preferred way ahead
- Should we delete the older volume
postgres-data
by going into Docker Desktop -> Volumes ? - or Should we create a new volume with separate name and mount it for postgres container ?
Thank you for reading, I am looking for expert advise on how people from DevOps world deal with this issue.