TFNS / CTFNote

CTFNote is a collaborative tool aiming to help CTF teams to organise their work.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup docker instance with pre existing postgresql db?

AngelouDi opened this issue · comments

I am trying to setup ctfnote dockerized and connect it to another postgresql db running on a port other than 5432.

I haven't found any way to make it work.

Is there an obvious way I am missing?

Hi @AngelouDi,

To achieve this, I think you will need to connect the ctfnote API to the "host network":

https://docs.docker.com/network/host/

This way, the container will share the same network as the host and it will be able to communicate with an external service.

If the database is in the same network as the API, you will just have to modify the environment variable provided to the API container in the docker-compose.yml file.

    environment:
      # [...]
      DB_HOST: db # Change here
      DB_PORT: 5432 # Change here
      WEB_PORT: 3000
commented

I think it is also possible to only map the single host port to port 5432 in the container: https://docs.docker.com/compose/networking/. This way, you don't expose all your host ports to the containers but only the port they require to reach.