Skip to content

ghcr.io/devcontainers/features/git:1 changes mode of /tmp to 755 causing "mkdir: cannot create directory ‘/tmp/.X11-unix’: Permission denied" #1480

Open

Description

@keestux

Adding feature ghcr.io/devcontainers/features/git:1 causes the mode of /tmp in the container to be changed to 0755.

This is my devcontainer.json

{
	"name": "myproj",
	"build": {
		"dockerfile": "Dockerfile",
		"context": ".."
	},
	"features": {
		"ghcr.io/devcontainers/features/git:1": {}
	}
}

and this is the Dockerfile

ARG VARIANT="3.11"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

RUN ls -la /tmp

It might also be important to mention that I'm using podman. I don't have docker at hand, so I don't know if that plays a role in this bug.

When I do a "Reopen in Container" in vscode I eventually get this error:

...
[1/3] STEP 1/2: FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.11 AS dev_container_auto_added_stage_label
[1/3] STEP 2/2: RUN ls -la /tmp
total 0
drwxrwxrwt. 1 root root 36 Jun  8  2023 .
dr-xr-xr-x. 1 root root 24 Sep 13 19:23 ..
drwxr-xr-x. 1 root root  0 Jun  8  2023 build-features-src
drwxr-xr-x. 1 root root 66 Jun  8  2023 dev-container-features
--> 77f2db5530a2
...
[38726 ms] Start: Run in container: test -e /tmp/.X11-unix/X0
[38727 ms] 
[38727 ms] 
[38727 ms] Exit code 1
[38727 ms] Start: Run in container: mkdir -p '/tmp/.X11-unix'
[38729 ms] 
[38729 ms] mkdir: cannot create directory ‘/tmp/.X11-unix’: Permission denied
[38730 ms] Exit code 1
[38733 ms] Command in container failed: mkdir -p '/tmp/.X11-unix'
[38733 ms] mkdir: cannot create directory ‘/tmp/.X11-unix’: Permission denied
[38734 ms] Exit code 1

When this happens, before canceling, I can "exec" into the container from another terminal and look at /tmp in the container.

$ podman exec -t -i jovial_sutherland /bin/bash
root ➜ / $ ls -ld /tmp/
drwxr-xr-x. 1 root root 80 Sep 13 19:23 /tmp/

Somewhere/somehow the mode of /tmp got changed.

If I drop the git feature the problem does not happen.

Activity

  1. v-Kaniska244 commented on Sep 17, 2025

    @v-Kaniska244
    Contributor

    Hello Kees Bakker (@keestux) ,

    Thank you for reporting this issue. I could see that you are using a very old dev container image as the base image for your dev container mcr.microsoft.com/vscode/devcontainers/python:0-3.11. That could very well be the reason behind this issue with git feature you reported.
    Would you kindly use latest images such as mcr.microsoft.com/vscode/devcontainers/python:2-3.11 or mcr.microsoft.com/vscode/devcontainers/python:2-3.11-bullseye and see if the issue persists?

  2. keestux commented on Sep 17, 2025

    @keestux
    Author

    Unfortunately that didn't make a difference.

    I must say, debugging this problem is extremely difficult, at least for me it is.

  3. v-Kaniska244 commented on Sep 18, 2025

    @v-Kaniska244
    Contributor

    Hello Kees Bakker (@keestux),

    Would you kindly share the complete log for this scenario with both show container log and show previous log options? That would be help us a great deal to investigate this further.

    Also you are using python pre-built dev container image which already includes the git feature in its dev container configuration. So you shouldn’t need to install it all over again.

  4. keestux commented on Sep 18, 2025

    @keestux
    Author

    Hey @Kaniska244

    I cannot (yet) show you any logging, but hold on.

    What I have been doing since yesterday is to use @devcontainers/cli to go through multiple edit-build-test cycles. Instead of loading features from the web I copied a feature from the src tree of this repo and placed it in a subdirectory of the .devcontainer. I worked my way through stripping the install.sh of the "feature". The start situation is when the build container has a 1777 for /tmp. And finally ended up with an install.sh that led to a container with mode 755 for /tmp.

    What I now have is this:

    $ find .devcontainer
    .devcontainer
    .devcontainer/Dockerfile
    .devcontainer/devcontainer.json
    .devcontainer/features
    .devcontainer/features/myfeat
    .devcontainer/features/myfeat/devcontainer-feature.json
    .devcontainer/features/myfeat/install.sh

    The files are really small, here they are

    $ cat .devcontainer/Dockerfile
    # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/python-3/.devcontainer/base.Dockerfile
    
    ARG VARIANT="3.11-bullseye"
    FROM mcr.microsoft.com/vscode/devcontainers/python:2-${VARIANT}
    $ cat .devcontainer/devcontainer.json
    {
    	"name": "myproj",
    	"build": {
    		"dockerfile": "Dockerfile",
    		"context": "..",
    		"args": {
    			"VARIANT": "3.11",
    			"NODE_VERSION": "none"
    		}
    	},
    	"remoteUser": "vscode",
    	"features": {
    	 	"./features/myfeat": {}
    	}
    }
    $ cat .devcontainer/features/myfeat/devcontainer-feature.json
    {
        "id": "myfeat",
        "version": "1.0.0",
        "name": "My Feat",
        "description": "Nothing to see here.",
        "options": {
            "installDirectlyFromGitHubRelease": {
                "type": "boolean",
                "default": true
            }
        }
    }
    $ cat .devcontainer/features/myfeat/install.sh
    #!/usr/bin/env bash
    
    set -e
    
        mkdir -p /tmp/ghcli
        pushd /tmp/ghcli
        popd
        rm -rf /tmp/ghcli

    With this setup I did:

    • npm install @devcontainers/cli
    • npx devcontainer up --workspace-folder .
    • npx devcontainer exec --workspace-folder . /bin/bash -c 'ls -ld /tmp/'

    The output of the last command is:

    $ npx devcontainer exec --workspace-folder . /bin/bash -c 'ls -ld /tmp/'
    drwxrwxrwt. 1 root root 80 Sep 18 18:37 /tmp/

    Next, delete all commands from install.sh to get

    #!/usr/bin/env bash
    exit 0

    Rebuild the container (first cleanup the previous images and container). Run the ls again. I then get

    $ npx devcontainer exec --workspace-folder . /bin/bash -c 'ls -ld /tmp/'
    drwxr-xr-x. 1 root root 80 Sep 18 19:01 /tmp/
  5. keestux commented on Sep 18, 2025

    @keestux
    Author

    In the install.sh, anything written to /tmp seems to be sufficient to avoid the 755 mode. This works too:

    #!/usr/bin/env bash
    echo hello > /tmp/hello.txt
  6. keestux commented on Sep 18, 2025

    @keestux
    Author

    I can provide the output of the npx devcontainer up --workspace-folder .. There is no difference between the good and bad case, except if the install.sh writes something to stdout.
    Let me know if you still want that log.

  7. Yokutto commented on Sep 18, 2025

    @Yokutto

    Hi Kees Bakker (@keestux),

    I'm digging about this issue with related issues that I found. I have noted that podman is a common factor between these issues, and specifically the podman above version 5.5.0, can you please confirm if that is your case?

    Maybe this isn't related to podman at all, but I find pretty weird that this started happening to me in the latest versions of podman, specially since they changed /tmp behavior on 5.6.1 and 5.5.0

  8. keestux commented on Sep 19, 2025

    @keestux
    Author

    Hi @keestux,

    I'm digging about this issue with related issues that I found. I have noted that podman is a common factor between these issues, and specifically the podman above version 5.5.0, can you please confirm if that is your case?

    Yes, correct. I'm using podman version 5.6.1 (on Fedora 42)

    Maybe this isn't related to podman at all, but I find pretty weird that this started happening to me in the latest versions of podman, specially since they changed /tmp behavior on 5.6.1 and 5.5.0

    Ah, interesting.

  9. keestux commented on Sep 21, 2025

    @keestux
    Author

    Where can I find the source code of devcontainers? Where can I report (podman) issues for devcontainers?

  10. v-Kaniska244 commented on Sep 22, 2025

    @v-Kaniska244
    Contributor

    Hello Kees Bakker (@keestux) ,

    I am checking on this.Will try to update by end of this week.

  11. v-Kaniska244 commented on Sep 29, 2025

    @v-Kaniska244
    Contributor
  12. NahsiN commented on Mar 7, 2026

    @NahsiN

    I'm running into a similar issue as OP. My devcontainer.json:

    // For format details, see https://aka.ms/devcontainer.json. For config options, see the
    // README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
    {
      "name": "Node.js & TypeScript",
      "image": "mcr.microsoft.com/devcontainers/typescript-node:4-22-bookworm",
      "features": {
        "ghcr.io/devcontainers-community/npm-features/prettier:1": {},
        "ghcr.io/guiyomh/features/just:0": {}
      },
      "postCreateCommand": "npm install --legacy-peer-deps",
      "forwardPorts": [3000]
    }

    Using podman version 5.7.1, I end up with similar permission error logs

    [2026-03-07T02:10:30.228Z] 
    [2026-03-07T02:10:30.228Z] Stop (1 ms): Run in container: cat /home/node/.vscode-server/data/Machine/settings.json
    [2026-03-07T02:10:30.231Z] Start: Run in container: test ! -f '/home/node/.vscode-server/data/Machine/.writeMachineMCPConfigMarker' && set -o noclobber && mkdir -p '/home/node/.vscode-server/data/Machine' && { > '/home/node/.vscode-server/data/Machine/.writeMachineMCPConfigMarker' ; } 2> /dev/null
    [2026-03-07T02:10:30.232Z] 
    [2026-03-07T02:10:30.232Z] 
    [2026-03-07T02:10:30.232Z] Exit code 1
    [2026-03-07T02:10:30.232Z] Stop (1 ms): Run in container: test ! -f '/home/node/.vscode-server/data/Machine/.writeMachineMCPConfigMarker' && set -o noclobber && mkdir -p '/home/node/.vscode-server/data/Machine' && { > '/home/node/.vscode-server/data/Machine/.writeMachineMCPConfigMarker' ; } 2> /dev/null
    [2026-03-07T02:10:30.233Z] Start: Run in container: test -d '/home/node/.vscode-server/bin/072586267e68ece9a47aa43f8c108e0dcbf44622'
    [2026-03-07T02:10:30.234Z] 
    [2026-03-07T02:10:30.234Z] 
    [2026-03-07T02:10:30.234Z] Stop (1 ms): Run in container: test -d '/home/node/.vscode-server/bin/072586267e68ece9a47aa43f8c108e0dcbf44622'
    [2026-03-07T02:10:30.234Z] Start: Run in container: test -d '/vscode/vscode-server/bin/linux-x64/072586267e68ece9a47aa43f8c108e0dcbf44622'
    [2026-03-07T02:10:30.235Z] 
    [2026-03-07T02:10:30.236Z] 
    [2026-03-07T02:10:30.236Z] Stop (2 ms): Run in container: test -d '/vscode/vscode-server/bin/linux-x64/072586267e68ece9a47aa43f8c108e0dcbf44622'
    [2026-03-07T02:10:30.236Z] Start: Run in container: /bin/sh
    [2026-03-07T02:10:30.241Z] Start: Run in container: test -x '/home/node/.vscode-server/bin/072586267e68ece9a47aa43f8c108e0dcbf44622/bin/helpers/check-requirements.sh'
    [2026-03-07T02:10:30.241Z] Start: Run in container: touch '/vscode/vscode-server/bin/linux-x64/072586267e68ece9a47aa43f8c108e0dcbf44622'
    [2026-03-07T02:10:30.242Z] 
    [2026-03-07T02:10:30.242Z] 
    [2026-03-07T02:10:30.242Z] Stop (1 ms): Run in container: test -x '/home/node/.vscode-server/bin/072586267e68ece9a47aa43f8c108e0dcbf44622/bin/helpers/check-requirements.sh'
    [2026-03-07T02:10:30.242Z] Start: Run in container: '/home/node/.vscode-server/bin/072586267e68ece9a47aa43f8c108e0dcbf44622/bin/helpers/check-requirements.sh'
    [2026-03-07T02:10:30.289Z] 
    [2026-03-07T02:10:30.289Z] 
    [2026-03-07T02:10:30.289Z] Stop (47 ms): Run in container: '/home/node/.vscode-server/bin/072586267e68ece9a47aa43f8c108e0dcbf44622/bin/helpers/check-requirements.sh'
    [2026-03-07T02:10:30.290Z] Start: Launching Dev Containers helper.
    [2026-03-07T02:10:30.291Z] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-f32077b4-ff12-43b7-a0ab-a706bedc4e6f.sock) forwarded to local host (/run/user/1000/gcr/ssh).
    [2026-03-07T02:10:30.291Z] Start: Run in container: test -e /tmp/.X11-unix/X0
    [2026-03-07T02:10:30.292Z] 
    [2026-03-07T02:10:30.293Z] 
    [2026-03-07T02:10:30.293Z] Exit code 1
    [2026-03-07T02:10:30.293Z] Stop (2 ms): Run in container: test -e /tmp/.X11-unix/X0
    [2026-03-07T02:10:30.293Z] Start: Run in container: mkdir -p '/tmp/.X11-unix'
    [2026-03-07T02:10:30.295Z] 
    [2026-03-07T02:10:30.296Z] mkdir: cannot create directory '/tmp/.X11-unix': Permission denied
    [2026-03-07T02:10:30.296Z] Exit code 1
    [2026-03-07T02:10:30.296Z] Stop (3 ms): Run in container: mkdir -p '/tmp/.X11-unix'
    [2026-03-07T02:10:30.305Z] Command in container failed: mkdir -p '/tmp/.X11-unix'
    [2026-03-07T02:10:30.305Z] mkdir: cannot create directory '/tmp/.X11-unix': Permission denied
    [2026-03-07T02:10:30.305Z] Exit code 1
    [2026-03-07T02:10:30.342Z] 
    [2026-03-07T02:10:30.344Z] 
    [2026-03-07T02:10:30.344Z] Stop (103 ms): Run in container: touch '/vscode/vscode-server/bin/linux-x64/072586267e68ece9a47aa43f8c108e0dcbf44622'
    

    I've also seen a similar issue posted on reddit

  13. kafumanto commented on Mar 9, 2026

    @kafumanto

    Hi! Thanks Kees Bakker (@keestux) for the great analysis!
    The problem still persists today, with Podman 5.8.0 and VSCode 1.110.1.
    In my case, the problem occurs when using the Debian 12 base image with the java feature (with only the Debian 12 base image it works):

    {
    	"name": "Debian + Java 21",
    	"image": "mcr.microsoft.com/devcontainers/base:debian-12",
    	"features": {
    		"ghcr.io/devcontainers/features/java:1": {
    			"version": "21"
    		}
    	}
    }

    The workaround (for me, and for the java feature) is to force /tmp to be a tmpfs with mode 1777:

    {
      // ...
      "runArgs": [
    		"--tmpfs=/tmp:rw,exec,nosuid,nodev,mode=1777"
    	]
    }
  14. sineme commented on Apr 15, 2026

    @sineme

    I am using docker and also have issues with /tmp

    docker version
    Client:
    Version:           29.3.0
    API version:       1.54
    Go version:        go1.26.1-X:nodwarf5
    Git commit:        5927d80c76
    Built:             Fri Mar  6 21:42:39 2026
    OS/Arch:           linux/amd64
    Context:           default
    
    Server:
    Engine:
    Version:          29.3.0
    API version:      1.54 (minimum version 1.40)
    Go version:       go1.26.1-X:nodwarf5
    Git commit:       83bca512aa
    Built:            Fri Mar  6 21:42:39 2026
    OS/Arch:          linux/amd64
    Experimental:     false
    containerd:
    Version:          v2.2.2
    GitCommit:        301b2dac98f15c27117da5c8af12118a041a31d9.m
    runc:
    Version:          1.4.1
    GitCommit:        1.4.1-1-0-gbcf35a0-dirty
    docker-init:
    Version:          0.19.0
    GitCommit:        de40ad0
    
    error log excerpt
    0.317 Installing ruby feature...                                                                                                                                                                                    
    0.393 Get:1 http://deb.debian.org/debian trixie InRelease [140 kB]
    0.421 Err:1 http://deb.debian.org/debian trixie InRelease
    0.421   Unable to mkstemp /tmp/apt.sig.mJLOct - GetTempFile (13: Permission denied)
    0.430 Get:2 http://deb.debian.org/debian trixie-updates InRelease [47.3 kB]
    0.432 Err:2 http://deb.debian.org/debian trixie-updates InRelease
    0.432   Unable to mkstemp /tmp/apt.sig.iLYqYQ - GetTempFile (13: Permission denied)
    0.444 Get:3 http://deb.debian.org/debian-security trixie-security InRelease [43.4 kB]
    0.446 Err:3 http://deb.debian.org/debian-security trixie-security InRelease
    0.446   Unable to mkstemp /tmp/apt.sig.FEQ1AC - GetTempFile (13: Permission denied)
    0.447 Reading package lists...
    0.451 W: OpenPGP signature verification failed: http://deb.debian.org/debian trixie InRelease: Unable to mkstemp /tmp/apt.sig.mJLOct - GetTempFile (13: Permission denied)
    0.451 E: The repository 'http://deb.debian.org/debian trixie InRelease' is not signed.
    0.451 W: OpenPGP signature verification failed: http://deb.debian.org/debian trixie-updates InRelease: Unable to mkstemp /tmp/apt.sig.iLYqYQ - GetTempFile (13: Permission denied)
    0.451 E: The repository 'http://deb.debian.org/debian trixie-updates InRelease' is not signed.
    0.451 W: OpenPGP signature verification failed: http://deb.debian.org/debian-security trixie-security InRelease: Unable to mkstemp /tmp/apt.sig.FEQ1AC - GetTempFile (13: Permission denied)
    0.451 E: The repository 'http://deb.debian.org/debian-security trixie-security InRelease' is not signed.
    

    I use mcr.microsoft.com/devcontainers/base:2-trixie as the base of my devcontainer and
    I get the error when I add one of the following features in devcontainer.json. If I remove them the build runs fine

    • ghcr.io/devcontainers/features/common-utils:2
      • Note: this feature is part of my base image. Having it in features used to work but I probably should've removed it
    • ghcr.io/rails/devcontainer/features/ruby
      • Note: installs after common-utils

    ghcr.io/devcontainers/features/git:1 works fine however

    devcontainer.json
    // For format details, see https://containers.dev/implementors/json_reference/.
    // For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/ruby
    {
      "name": "ruby_2_5_1_rails_5_2_6_devcontainer",
      "dockerComposeFile": "compose.yaml",
      "service": "rails",
      "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
      // Features to add to the dev container. More info: https://containers.dev/features.
      "features": {
          "ghcr.io/devcontainers/features/common-utils:2": {
            "installZsh": "true",
            "username": "vscode",
            "userUid": "1000",
            "userGid": "1000",
            "upgradePackages": "true"
          },
        "ghcr.io/devcontainers/features/git:1": {
          "version": "latest",
          "ppa": "false"
        },
          "ghcr.io/rails/devcontainer/features/ruby": {
            "version": "2.5.1",
            "versionManager": "rbenv"
          },
        "ghcr.io/rails/devcontainer/features/activestorage": {},
        "ghcr.io/rails/devcontainer/features/mysql-client": {}
      },
      "containerEnv": {
        "CAPYBARA_SERVER_PORT": "45678",
        "SELENIUM_HOST": "selenium",
        "KAMAL_REGISTRY_PASSWORD": "$KAMAL_REGISTRY_PASSWORD",
        "DATABASE_URL": "mysql2://mariadb",
        "MAILCATCHER_ADDRESS": "mailcatcher"
      },
      // Use 'forwardPorts' to make a list of ports inside the container available locally.
      "forwardPorts": [
        3000
      ],
      // Configure tool-specific properties.
      // "customizations": {},
    
      // Uncomment to connect as root instead. More info: https://containers.dev/implementors/json_reference/#remoteUser.
      // "remoteUser": "root",
    
      // Use 'postCreateCommand' to run commands after the container is created.
      "postCreateCommand": "fc-cache -fv && bin/setup --skip-server"
    }
    Dockerfile
    FROM mcr.microsoft.com/devcontainers/base:2-trixie
    
    ENV LANG=C.UTF-8 \
        LC_ALL=C.UTF-8
    
    # libxinerama1, libcups2 and libsm-dev are dependencies for libreoffice 6.4
    # default-jre is also needed by libreoffice but not a dependency
    RUN apt-get update -y && apt-get -y install --no-install-recommends  \
        default-jre \
        imagemagick \
        libxinerama1 \
        libcups2 \
        libsm-dev \
        && rm -rf /var/lib/apt/lists/*
    
    # install libreoffice 6.4
    RUN  wget -P /tmp https://downloadarchive.documentfoundation.org/libreoffice/old/6.4.7.2/deb/x86_64/LibreOffice_6.4.7.2_Linux_x86-64_deb.tar.gz && \
         tar -xvzf /tmp/LibreOffice_6.4.7.2_Linux_x86-64_deb.tar.gz -C /tmp && \
         dpkg -i /tmp/LibreOffice_6.4.7.2_Linux_x86-64_deb/DEBS/*.deb && \
         ln -n -s /opt/libreoffice6.4/ /usr/lib/libreoffice && \
         ln -n -s /usr/lib/libreoffice/program/soffice /usr/bin/soffice && \
         ln -n -s /usr/lib/libreoffice/program/soffice /usr/bin/libreoffice && \
         rm /tmp/LibreOffice_6.4.7.2_Linux_x86-64_deb.tar.gz && \
         rm -rf /tmp/LibreOffice_6.4.7.2_Linux_x86-64_deb
    
    USER vscode
    
    ENV BINDING="0.0.0.0"
    
    compose.yaml
    name: "ruby_2_5_1_rails_5_2_6_devcontainer"
    
    services:
      rails:
        build:
          context: ..
          dockerfile: .devcontainer/Dockerfile
    
        # Overrides default command so things don't shut down after the process ends.
        command: sleep infinity
    
        # Uncomment the next line to use a non-root user for all processes.
        # user: vscode
    
        depends_on:
        - selenium
        - mariadb
        - mailcatcher
    
      selenium:
        image: selenium/standalone-chromium
        restart: unless-stopped
    
      mariadb:
        image: mariadb:11.4.10
        restart: unless-stopped
        environment:
          MARIADB_ROOT_PASSWORD: root # newer versions
          MYSQL_ROOT_PASSWORD: root # older versions
        volumes:
          - mariadb-data:/var/lib/mysql
        ports:
          - "3306:3306"
    
      mailcatcher:
        restart: on-failure
        image: sj26/mailcatcher:v0.10.0
        ports:
          - "1080:1080" # Web Interface
          - "1025:1025" # SMTP Port
    
    volumes:
      mariadb-data:
    
    
  15. georglauterbach commented on Jul 12, 2026

    @georglauterbach

    I am hitting this issue too; it seems to be related to using features. When I am not using features, it seems to work. Without having checked, I assume the devcontainer CLI adjusts /tmp/ for Features in a way that causes privilege issues. If someone here is better at Typescript than I am, please quickly check https://github.com/devcontainers/cli to see whether something is being done with /tmp/.

    Mounting a tmpfs as described in #1480 (comment) does indeed solve the issue for now, but I'd like to know what the actual culprit it so I don't have to supply such runArgs every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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