To connect to db in container from another container, here create_engine(f"postgresql://{self.user}:{self.password}@{self.host}:{self.port}")
the self.host
should be your db docker container name as in docker compose. Should work like charm with postgres or other db.