Skip to content

Remote-Containers: Installing VSCode server fails if non-root user exists in dockerfile #174

Closed

Description

@nphmuller

Repro:

  • Run Remote-Containers: Open folder in container... command
  • Select random folder
  • Pick Node.js (latest LTS)
  • Open dockerfile
  • Add USER node at end of dockerfile
  • Run Remote-Containers: Rebuild Container command.
  • An error occurred setting up the container.

Error output from CLI:

Run: docker exec d966a5be56a326af65b0a3f7bab0e90b2f4ef77f23b29874f342ddd78d5083b5 test -d /root/.vscode-remote/bin/473af338e1bd9ad4d9853933da1cd9d5d9e07dc9
Installing VS Code Server for commit 473af338e1bd9ad4d9853933da1cd9d5d9e07dc9
Run: docker exec d966a5be56a326af65b0a3f7bab0e90b2f4ef77f23b29874f342ddd78d5083b5 mkdir -p /root/.vscode-remote/bin/473af338e1bd9ad4d9853933da1cd9d5d9e07dc9_1557150875999
mkdir: cannot create directory '/root': Permission denied
Command failed: C:\Program Files\Docker\Docker\Resources\bin\docker.exe exec d966a5be56a326af65b0a3f7bab0e90b2f4ef77f23b29874f342ddd78d5083b5 mkdir -p /root/.vscode-remote/bin/473af338e1bd9ad4d9853933da1cd9d5d9e07dc9_1557150875999

Activity

  1. egamma commented on May 6, 2019

    @egamma
    Member

    Nick Muller (@nphmuller) does reloading the Window (Command Developer: Reload Window) recover from this situation?

  2. added
    containers
    info-needed
    on May 6, 2019
  3. nphmuller commented on May 6, 2019

    @nphmuller
    Author

    Nope. The situation can only be resolved by removing the non-root user from the Dockerfile.

  4. egamma commented on May 6, 2019

    @egamma
    Member

    Nick Muller (@nphmuller) can you share your Dockerfile in this issue?

  5. egamma commented on May 6, 2019

    @egamma
    Member
  6. nphmuller commented on May 6, 2019

    @nphmuller
    Author

    It's basically the Node.js (latest LTS) template, with the single line added that I described. But sure.

    #-------------------------------------------------------------------------------------------------------------
    # Copyright (c) Microsoft Corporation. All rights reserved.
    # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
    #-------------------------------------------------------------------------------------------------------------
    
    FROM node:lts
    
    # Configure apt
    ENV DEBIAN_FRONTEND=noninteractive
    RUN apt-get update \
        && apt-get -y install --no-install-recommends apt-utils 2>&1
    
    # Verify git and needed tools are installed
    RUN apt-get install -y git procps
    
    # Remove outdated yarn from /opt and install via package 
    # so it can be easily updated via apt-get upgrade yarn
    RUN rm -rf /opt/yarn-* \
        rm -f /usr/local/bin/yarn \
        rm -f /usr/local/bin/yarnpkg \
        && apt-get install -y curl apt-transport-https lsb-release \
        && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \
        && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
        && apt-get update \
        && apt-get -y install --no-install-recommends yarn
        
    # Install eslint
    RUN npm install -g eslint
    
    # I ADDED THIS:
    USER node
    
  7. removed
    info-needed
    on May 6, 2019
  8. chrmarti commented on May 7, 2019

    @chrmarti
    Contributor

    Try adding ENV HOME /home/node after USER node. This is a limitation tracked as #22.

  9. added
    *duplicate
    on May 7, 2019
  10. locked and limited conversation to collaborators on Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*duplicatecontainers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions