Skip to content

Missing user node #1

Description

@QuadTriangle

I usually deploy Node.js docker container with user node to avoid deploying with root user. It seems like node-caged does not have node user and default user is root which is not safe in production deployment.

# # ###### final image ######
FROM node:24-slim

........

WORKDIR /app

COPY --chown=node --from=builder /app/ /app/

......

USER node

EXPOSE 4000

CMD ["./start.sh"]

For reference here is official node dockerfile:

https://github.com/nodejs/docker-node/blob/main/Dockerfile-slim.template#L3-L4

It is also recommened by docker-node Best Practices:
https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions