Re: [ADMIN] Risks of running Postgres as a Docker container? - Mailing list pgsql-admin

From Tom Lane
Subject Re: [ADMIN] Risks of running Postgres as a Docker container?
Date
Msg-id 17550.1506347026@sss.pgh.pa.us
Whole thread Raw
In response to [ADMIN] Risks of running Postgres as a Docker container?  (Gustav Karlsson <gustav.karlsson@bekk.no>)
List pgsql-admin
Gustav Karlsson <gustav.karlsson@bekk.no> writes:
> At my company we are getting more and more small databases and are considering moving to deploying them as Docker
containersfor easier management. However, every time I am trying to research the topic of databases as containers, I
comeacross people saying "I would not run a production database in Docker" and similar. Though there do also seem to be
plentyof people doing that as well! 

> So, I was just wondering what the experiences in the community are?
> - Anybody running production databases in Docker? Have you experienced many issues?
> - What are the risks of doing it? (We would of course mount an external volume for the data-directory)

I wouldn't count on an external data directory to save you if the Docker
instance crashes.  The trouble with any virtualized environment (not just
Docker) is that you have an extra layer of I/O abstraction between you and
the hardware, which for this purpose means one more place that might break
fsync semantics/write ordering guarantees.  You'd never notice till you
get a hard crash and find your database is corrupted.

If it's throwaway data, this doesn't matter of course.  If your recovery
strategy is mostly depending on streaming standby servers, and not on
being able to recover the primary, it might not matter either.  But if you
need the DB to be crash-safe, you really had better do plug-pull-type
testing before trusting a setup like this.
        regards, tom lane


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

pgsql-admin by date:

Previous
From: Gustav Karlsson
Date:
Subject: Re: [ADMIN] Risks of running Postgres as a Docker container?
Next
From: Garry Chen
Date:
Subject: [ADMIN] Foreign data wrappers for Oracle from Postgresql in RDS environment