-
Notifications
You must be signed in to change notification settings - Fork 303
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
Determine install folder from within the container #22
Comments
@threaz It will respect whatever HOME is set to, so this will work: ARG USERNAME=user-name-goes-here
RUN useradd -m $USERNAME
ENV HOME /home/$USERNAME
# [Optional] Add sudo support
RUN apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME
# ** Anything else you want to do like clean up goes here **
USER $USERNAME Does this solve your issue? |
I'm having the exact same issue but I don't have access to modify the Dockerfile of the container image, which doesn't specify a HOME. Is there any other way around this? Thanks. |
Thanks for your response @Chuxel. Specifying |
Ideally we would find out what the home folder is from within the container without relying on HOME on the container's or image's inspect data. For now setting HOME with |
I am having the same issue. I don't have access to the DockerFile.
|
@javierdihu and @vijay609: if you don't have access to the {
...
"runArgs": [ "--env", "HOME=/home/yourusername" ]
} If you're using {
"dockerComposeFile": [
"path/to/your/base/docker-compose.yml",
"docker-compose.extend.yml"
],
"service": "yourservice",
...
} and inside services:
yourservice:
environment:
HOME: /home/yourusername disclaimer: I only tested the |
@vijay609 Thanks for the tip. Note that this doesn't work if the container was started with |
@chrmarti Why not install in /tmp? Out of curiosity, what are you installing inside the image anyway? |
@nickolai-voyage educated guess: because |
@nickolai-voyage We install the VS Code Server. Using the user's home folder seemed to make the most sense since that is also owned by the same user (which is not necessarily root), we also place settings and extensions in |
Running the container with |
We now read the home folder from |
@SoftwareApe Would this potentially be possible with something like docker-compose up -e HOME=/user/yourusername? I've tried adding the mentioned solutions to my dockerfile or docker-compose.yml but still get the no access to root message. :( |
@MojoJojo86 Would using the home folder from |
@MojoJojo86 thank you, the home folder trick works on stable! |
@chrmarti Cheers I tried the insiders edition and that worked. |
Steps to Reproduce:
Dockerfile
with user different than rootRemote Containers: Attach to running container...
That's because the user specified in
Dockerfile
can't create directories in/root
. Is there a way for vscode to select different path than/root/.vscode-remote
?The text was updated successfully, but these errors were encountered: