Docker plugin creates(and recreates) extra container [containername]-run-[hash] that takes the port of the original

Hi,

I use Docker plugin to run my Docker compose setup. When I run the configuration one of my app's containers get this [containername]-run-[hash] containers which takes the port of the original container. How can I prevent these containers to be created? If i delete them they get recreated immediately.

FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18 as base

ENV NEXT_TELEMETRY_DISABLED=1

RUN tdnf install ca-certificates procps-ng shadow-utils -yq && \
    groupadd --gid=1000 node && \
    useradd --uid=1000 --gid=1000 --create-home node

USER node

WORKDIR /home/node/app

EXPOSE 4000

FROM base AS dev

EXPOSE 9245-9246

VOLUME [ "/home/node/app/src" ]

COPY docker-entrypoint.sh /etc/init/

COPY --chown=node:node package*.json ./

RUN --mount=type=secret,id=npmrc,dst=/home/node/.npmrc,uid=1000,required \
    npm ci --no-audit

COPY --chown=node:node . .

ENTRYPOINT [ "/etc/init/docker-entrypoint.sh" ]

CMD [ "npm", "run", "dev" ]

FROM base as build

COPY --chown=node:node .env* ./

RUN --mount=type=secret,id=npmrc,dst=/home/node/.npmrc,uid=1000,required \
    --mount=type=bind,source=package.json,target=package.json \
    --mount=type=bind,source=package-lock.json,target=package-lock.json \
    --mount=type=bind,source=.npmrc,target=.npmrc \
    --mount=type=bind,source=next.config.js,target=next.config.js \
    --mount=type=bind,source=postcss.config.js,target=postcss.config.js \
    --mount=type=bind,source=tailwind.config.ts,target=tailwind.config.ts \
    --mount=type=bind,source=tsconfig.json,target=tsconfig.json \
    --mount=type=bind,source=src,target=src/ \
    npm ci --no-audit && \
    NODE_ENV=production npm run build && \
    npm prune --omit=dev --no-audit --ignore-scripts --no-save && \
    npm cache clean --force && \
    rm next-env.d.ts

FROM base as final

ENV NODE_ENV=production PATH=/home/node/app/node_modules/.bin:$PATH

COPY --chown=node:node public public/
COPY --from=build --chown=node:node /home/node/app .

ENTRYPOINT [ "next", "start" ]

CMD [ "-p", "4000" ]
 

0

请先登录再写评论。