Skip to content

dir_create can't set permission from docker #495

@LDalby

Description

@LDalby

When creating a new directory using fs::dir_create from docker using this simple docker file:

FROM rocker/r-ver:4.5.1

RUN Rscript -e "if (!requireNamespace('fs', quietly = TRUE)) install.packages('fs', repos='https://cloud.r-project.org')"

VOLUME /data

CMD ["Rscript", "-e", "fs::dir_create('/data/fs-dir')"]

build with:

docker build -t dir-maker .

and run:

docker run --rm \                                            
  -v ~/<PATH>:/data:rw \
  dir-maker

I get this error:

Error: [EACCES] Failed to set permissions for directory '/data/fs-dir': permission denied
Execution halted

The new directory is actually created, but with permissions r-xr--r-x.

I thought that it was related to the permission settings for Docker on macos, but now I'm leaning towards this actually being an fs issue.
If I create a new directory using base::dir.create() the directory is created (rwxr-xr-x) without error (same docker build and run commands).

FROM rocker/r-ver:4.5.1

VOLUME /data

CMD ["Rscript", "-e", "dir.create('/data/base-dir')"]

Possibly related to #465 and #293

─ Session info ────────────────────────────────────────────────────────
 setting  value
 version  R version 4.5.1 (2025-06-13)
 os       macOS Sequoia 15.5
 system   aarch64, darwin20
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Copenhagen
 date     2025-07-07
 pandoc   NA
 quarto   1.6.40 @ /usr/local/bin/quarto

fs            1.6.6   2025-04-12 [1] CRAN (R 4.5.0)

Docker version 28.2.2, build e6534b4

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