Skip to content

Prisma (docker): "Server selection timeout: No available servers." (with repo example) #21399

Answered by dejurin
dejurin asked this question in Q&A
Discussion options

You must be logged in to vote

I updated if you remove (Dockerfile) the

  • pnpm dlx prisma init --datasource-provider mongodb
    and
  • pnpm dlx prisma db pull --force
    then the prism connects and works fine.

So I conclude that initialization and schema creation should be done on the local computer before create docker compose. In my case, I tried to do all the steps while creating the containers.

Old:

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile && \
    pnpm dlx prisma init --datasource-provider mongodb && \
    pnpm dlx prisma db pull --force && \
    pnpm dlx prisma generate && \
    pnpm run build

New

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile && …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dejurin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant