Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nphmuller opened this issue May 6, 2019 · 6 comments
Assignees
Labels
containers Issue in vscode-remote containers *duplicate Issue identified as a duplicate of another issue(s)

Comments

@nphmuller
Copy link

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
@egamma
Copy link
Member

egamma commented May 6, 2019

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

@egamma egamma added containers Issue in vscode-remote containers info-needed Issue requires more information from poster labels May 6, 2019
@nphmuller
Copy link
Author

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

@egamma
Copy link
Member

egamma commented May 6, 2019

@nphmuller can you share your Dockerfile in this issue?

@egamma
Copy link
Member

egamma commented May 6, 2019

//fyi @chrmarti

@nphmuller
Copy link
Author

nphmuller commented May 6, 2019

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

@egamma egamma removed the info-needed Issue requires more information from poster label May 6, 2019
@chrmarti
Copy link
Contributor

chrmarti commented May 7, 2019

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

@chrmarti chrmarti closed this as completed May 7, 2019
@chrmarti chrmarti added the *duplicate Issue identified as a duplicate of another issue(s) label May 7, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants