It is currently Mon Jul 23, 2018 7:31 pm
All times are UTC + 8 hours

postgres in docker

Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

postgres in docker

Postby Oleksandr » Thu May 10, 2018 9:33 pm

Hello everyone.
Did anybody run Postgres docker container successfully?

I run the following commands:
Code: Select all
docker volume create pgdata
docker run -it -p 5432:5432 --rm -v pgdata:/var/lib/postgresql/data postgres


The server starts but I am not able to establish connection through mapped port.
These commands works fine on fresh Debian system.

Is there anything else to configure?

Thanks.
Oleksandr
 
Posts: 3
Joined: Mon Apr 23, 2018 5:21 pm

Re: postgres in docker

Postby Oleksandr » Fri May 11, 2018 4:23 am

Using
Code: Select all
docker run -it --rm --network host -v pgdata:/var/lib/postgresql/data postgres

Works fine.
Oleksandr
 
Posts: 3
Joined: Mon Apr 23, 2018 5:21 pm

Re: postgres in docker

Postby vitosx » Wed May 16, 2018 6:44 pm

I can confirm that --publish (-p) option indeed does not work as expected, with other containers as well. I can only connect to the port from NAS itself, not from other hosts. All necessary iptables rules seem to be there... but are not working.

EDIT:
Actually, not all necessary iptables rules are present. There are no proper entries in FORWARD chain.
I added them with these commands, and my published port is accessible from other hosts:
Code: Select all
/volume0/usr/builtin/sbin/iptables -A FORWARD -i eth0 -o docker0 -j DOCKER
/volume0/usr/builtin/sbin/iptables -A FORWARD -i docker0 -o eth0 -j ACCEPT


Note that this configuration will most probably allow all incoming connections to docker containers, regardless of your firewall / ADM Defender settings.
vitosx
 
Posts: 35
Joined: Sun Sep 24, 2017 11:30 pm

Return to Docker

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 1 guest