pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gustav Karlsson <gustav.karlsson@bekk.no>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Risks of running Postgres as a Docker container?
Date: Mon, 25 Sep 2017 09:43:46 -0400
Message-ID: <17550.1506347026@sss.pgh.pa.us> (raw)
In-Reply-To: <HE1PR0402MB33877605E20BDD4839CE5D61EB7A0@HE1PR0402MB3387.eurprd04.prod.outlook.com>
References: <HE1PR0402MB33877605E20BDD4839CE5D61EB7A0@HE1PR0402MB3387.eurprd04.prod.outlook.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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 containers for easier management. However, every time I am trying to research the topic of databases as containers, I come across people saying "I would not run a production database in Docker" and similar. Though there do also seem to be plenty of 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



view thread (7+ messages)

Message-ID: <17550.1506347026@sss.pgh.pa.us>
Permalink:  ../17550.1506347026@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17550.1506347026@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gustav.karlsson@bekk.no
  Subject: Re: Risks of running Postgres as a Docker container?
  In-Reply-To: <17550.1506347026@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox