Skip to content

Corepack should have an option to be able to run on a readonly docker container #183

@marcmillien

Description

@marcmillien

Description

I currently have the following Dockerfile:

FROM node:18-bullseye              
RUN corepack enable yarn

My production environment runs this image in readonly, this way:

docker run --rm -it --read-only --mount 'type=tmpfs,dst=/tmp' IMAGE_BUILT bash

The problem is we can't instruct corepack to not write cache folder leading to the following error running yarn:

root@5cd6509d006b:/# yarn --version
Internal Error: ENOENT: no such file or directory, mkdir '/root/.cache'
Error: ENOENT: no such file or directory, mkdir '/root/.cache'

My current workaround is to use /tmp (monkey patch, this folder is not the best from security perspective):

FROM node:18-bullseye              
ENV COREPACK_HOME /tmp/corepack
RUN corepack enable yarn

I think, the good solution from a security perspective would be to have an option to instruct corepack not to write anything.

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