Cannot edit files inside devcontainer container in vscode

206 views Asked by At

I successfully created a devcontainer image with devcontainer build command with cli. Now I want to use it to edit files inside the docker image so what I did was that I created new folder .devcontainer with below files. devcontainer.json

{
    "name": "test docker",
    "dockerFile": "Dockerfile"
}

Dockerfile

FROM my-image:latest
USER myuser
RUN chown -R myuser:mygroup /workspace
WORKDIR /workspace

I tried to reopen in container in vscode and it started the environment but somehow in a differently set workdir. Then I went to the right directory and tried to modify the files but it didn't let me modify it ( cannot save the file). This is the Dockerfile that I used to build the image.

FROM mcr.microsoft.com/devcontainers/python:1-3.11-bullseye
WORKDIR /workspace
RUN groupadd -r mygroup && useradd -r -g mygroup myuser
RUN chown -R myuser:mygroup /workspace
USER myuser
COPY . .

How can I fix this issue?

0

There are 0 answers