Question about needing host network in running pouchdb-server inside docker

Viewed 23

I have this docker image that exposes port 5984 from a pouchdb-server running inside a docker container.

Here's what Dockerfile looks like:

From node:16-alpine

WORKDIR /pouchdb
RUN apk update
RUN npm install --location=global pouchdb-server

EXPOSE 5984

ENTRYPOINT ["pouchdb-server"]
CMD ["--port", "5984"]

Running the container using the default bridge network doesn't work:

docker run -d -v $(pwd)/pouchdb -p 5984:5984 pouchdb-server:v1

But upon running the container using the host docker network, it works like a charm. docker run -d -v $(pwd)/pouchdb -p 5984:5984 --network host pouchdb-server:v1.

I understand that it removes the network isolation between docker and host network but this has the caveat of possible port conflicts.

My question is, is there any way to export make this work without using host network?

0 Answers
Related