Docker PostgresSQL in FreeNAS

Hi,

I’m trying to setup a PostgreSQL database for DaVinci Resolve sharing and I’m stumbling. I tried following this video: https://www.youtube.com/watch?v=AL0XjDDbt28
and this article: https://hackernoon.com/dont-install-postgres-docker-pull-postgres-bee20e200198

I managed to create the Docker, and RancherOS is installed. Already pulled Postgres. But then I’m stumped because I think I’m doing it wrong with the database creation as well as the IP setting. Can anybody help?

That’s the compose file I’ve been using once for a postgresql docker container including pgadmin.

version: '3'
services:
        postgresql:
                image: "postgres"
                restart: always
                container_name: postgres
                ports:
                        - "5432:5432"
                environment:
                        - POSTGRES_USER=user
                        - POSTGRES_PASSWORD=password
                        - PGDATA=/var/lib/postgresql/data/pgdata
                volumes:
                        - /some/path/to/postgresql_data:/var/lib/postgresql/data/pgdata
        pgadmin:
                image: "dpage/pgadmin4"
                restart: always
                container_name: pgadmin
                ports:
                        - "8081:80"
                environment:
                        - [email protected]
                        - PGADMIN_DEFAULT_PASSWORD=SuperSecret
                volumes:
                        - /some/path/to/pgadmin_data:/var/lib/pgadmin

If you install docker compose you can just change the some/path/to things to wherever you want them on your host and docker-compose up -d the thing and it should work. What’s also cool about compose it that it automatically sets up a network for all docker containers in that file so your pgadmin can connect with postgresql using http://postgres:5432 in this example instead of the ip (witch depending on your configuration might not even be reachable from the outside, if you don’t map it to something like the 8081:80 in case of pgadmin mapping port 8081 on the host to 80 in the container, you won’t be able to get to it).


About rancheros from my limited exposure to it. I would not really recommend it. If you want a small linux vm I’d rather use alpine-linux than that thing (if it really needs to be small, you still get a relatively normal linux install out of it that you can install other stuff on). Debian, ubuntu-server or centos are all fine too. You really don’t need a “container-os”.

After figuring out how to login with the ssh-only, single-user-only type of login. I figured out there is no real package manager other than docker and I have to jump threw hoops to get my network shares mounted. I just got rid of it. Because whatever the next best thing was I grabbed would not give me weird limitations that I never wanted to solve.

If this is your first exposure to docker. You should not be using rancheros either. It makes it more complicated than simple. It can be worth it. But not for a single postgresql install.

1 Like

Thanks @maximal. This is definitely my first time using docker so I will try to follow your suggestion and keep you posted. Just to be clear, I’m running Alpine in a VM instead of Docker?

Sorry, I did not necessarily recommend you to install alpine, all I said was id rather do that than rancheros.

Alpine is likely gonna do that perfectly fine. Its a great distro for its 20mb size a good amount of available packages for what it is. Witch if nothing else there are a lot more packages than you would have had on rancheros (witch effectively has one package, docker). If on rancheros something does not work in docker the rancheros solution is to build a custom docker image yourself. :sweat_smile: You really should know a thing or two about docker and know what you are getting yourself into for using that.

Ive been using alpine as a docker base image (not host), witch is what its most popular for, in wsl and for arbitrary gitlab-ci stages.

It will get the job done as a docker host just fine. I actually meant to recommend centos, debian or ubuntu-server though.

I do not know your linux experience, so Im not sure.

Alpine is small, witch is why I thought you might want it over the rest, since rancheros is what you end up finding searching for lightweight docker distros. Alpine has a decent wiki that explains how to install it (there is no gui installer it starts from ram and then you got some installer script, its not like installing arch, its easy, but guis take space, alpine does not use space). Docker is in the community repo and compose you can install with pip.

https://wiki.alpinelinux.org/wiki/Docker
https://wiki.alpinelinux.org/wiki/Install_to_disk

Most importantly get something going. :sweat_smile: But if you dont have much experience with anything linux or docker, Id say use ubuntu-server. If you are a bit more motivated and want to have it take up no space, then go alpine. Its not hard to do. Its gonna work out fine. But most of the bulk of user friendly guides revolve around ubuntu-server.

Hi @maximal ,

In the end, I used a jail for my PostgresSQL. Had to combine 3 different guides to make it work but now it’s working and flawless.

2 Likes

Hi @clueluzz could you help me out? I tried to the rocky road to use a jail. I have a jail, postgres up and running, but cant use davinci with it.
What version of postgres do you use? what user? what rights?

thankful for any help