Docker Community Forums

Share and learn in the Docker community.

Docker container + PostgresSQL

#1

Hi,

I am new to docker and want to understand how can I make my container stateless or the below scenario. Any help is greatly appreciated.

We want to containerize our PostgreSQL database. But we want this container to be stateless, I mean keep the data out of the container (either on host machine or outside host machine. My question is

-> is this possible? Or it is purely dependent on the respective s/w (Postgres SQL) to support it?
-> Does docker restrict such thing?
-> How does this work when the container is scaled?
-> Will this create any performance issues?

Any inputs or pointers towards this is highly appreciated.

Thanks,
ub

(Nitishmowall) #2

hey @bedampeta

yes it possible. When you are running your container you can mount a host path inside the container using volume opt. store the data of postgres in this folder so that we container stops or removes you can start you container again with this path.
read below link for more

in case of scaling you can use called docker volume plugin which will require you to create storage server and docker provide some volume plugin support for some storage which you can check from below link section fo volume plugins.