Обсуждение: [ADMIN] Risks of running Postgres as a Docker container?

Поиск
Список
Период
Сортировка

[ADMIN] Risks of running Postgres as a Docker container?

От
Gustav Karlsson
Дата:

Hi,


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)



Regards,

Gustav Karlsson


Re: [ADMIN] Risks of running Postgres as a Docker container?

От
robert
Дата:

for the last 2 years I am running several databases in docker containers.

I am using preconfigured images, have done nothing to change  and I am happy with them

robert

On 25.09.2017 07:08, Gustav Karlsson wrote:

Hi,


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)



Regards,

Gustav Karlsson



Re: [ADMIN] Risks of running Postgres as a Docker container?

От
Vladimir Rusinov
Дата:

On Mon, Sep 25, 2017 at 6:08 AM, Gustav Karlsson <gustav.karlsson@bekk.no> wrote:

- Anybody running production databases in Docker? Have you experienced many issues?


Yes, and yes. :)
 

- What are the risks of doing it? (We would of course mount an external volume for the data-directory)


We have not seen any durability issues due to docker. We have seen some docker bugs where individual containers or the whole docker daemon will get stuck in weird states, but it seems to have gotten better in recent releases. If you have less than a hundred instances you are unlikely to see these.

-- 
Vladimir Rusinov
PostgreSQL SRE, Google Ireland

Google Ireland Ltd.,Gordon House, Barrow Street, Dublin 4, Ireland
Registered in Dublin, Ireland
Registration Number: 368047

Re: [ADMIN] Risks of running Postgres as a Docker container?

От
scott ribe
Дата:
On Sep 24, 2017, at 11:08 PM, Gustav Karlsson <gustav.karlsson@bekk.no> wrote:
>
> - Anybody running production databases in Docker? Have you experienced many issues?

https://www.compose.com ;-)

--
Scott Ribe
scott_ribe@elevated-dev.com
(303) 722-0567



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

Re: [ADMIN] Risks of running Postgres as a Docker container?

От
Manuel Gómez
Дата:
On Mon, Sep 25, 2017 at 7:09 AM Gustav Karlsson <gustav.karlsson@bekk.no> wrote:

- 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)

Rather than particular risks, there is some work you may have to do to enjoy all the benefits of deploying Postgres in Docker, specifically regarding deploying images with the appropriate configuration for automated backups and automated/assisted distributed cluster management, which you generally want for production.

There's a lot of experience with these problems collected in some open-source projects, though!  You may be interested in Spilo https://github.com/zalando/spilo and Patroni https://github.com/zalando/patroni — and keep an eye out for Kubernetes-native support currently being tested in Patroni: https://github.com/zalando/patroni/pull/500

Note there are some relevant talk videos listed here: https://github.com/zalando/patroni#how-patroni-works

(Full disclosure: I work in the team that develops and provides support for internal use of these projects at Zalando.)

Re: [ADMIN] Risks of running Postgres as a Docker container?

От
Gustav Karlsson
Дата:

Thank you all for the feedback! It seems my concerns may be a bit out-dated 😊


Manuel, I have been looking quite a bit at Patroni, and will quite possibly be using that in our setup. Thank you for sharing it with the community! (and ofc also a thank you to Compose for Governor)


Regards,

Gustav


Fra: Manuel Gómez <targen@gmail.com>
Sendt: 25. september 2017 13:37:46
Til: Gustav Karlsson; pgsql-admin@postgresql.org
Emne: Re: [ADMIN] Risks of running Postgres as a Docker container?
 
On Mon, Sep 25, 2017 at 7:09 AM Gustav Karlsson <gustav.karlsson@bekk.no> wrote:

- 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)

Rather than particular risks, there is some work you may have to do to enjoy all the benefits of deploying Postgres in Docker, specifically regarding deploying images with the appropriate configuration for automated backups and automated/assisted distributed cluster management, which you generally want for production.

There's a lot of experience with these problems collected in some open-source projects, though!  You may be interested in Spilo https://github.com/zalando/spilo and Patroni https://github.com/zalando/patroni — and keep an eye out for Kubernetes-native support currently being tested in Patroni: https://github.com/zalando/patroni/pull/500

Note there are some relevant talk videos listed here: https://github.com/zalando/patroni#how-patroni-works

(Full disclosure: I work in the team that develops and provides support for internal use of these projects at Zalando.)

Re: [ADMIN] Risks of running Postgres as a Docker container?

От
Tom Lane
Дата:
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