2

Whenever I attach VSCode to a container, it starts with no specific folder opened. I want to open folder "/ado" on start and apply the workspace settings there. How can I achieve this?

When I open the folder manually, I start in the /root folder of the container.

.devcontainer.json:

{
    "name": "Portal Docker Environment",
    "dockerComposeFile": "docker-compose.yml",
    "service": "api",
    "workspaceFolder": "/ado",
    "cwd": "/ado",
    "extensions": [
        "ms-python.python",
        "visualstudioexptteam.vscodeintellicode"
    ]
}

docker-compose.yml:

portal:
  build: Dockerfiles/portal
  image: portal
  command: launch_portal.py
  volumes:
    - ./ado:/ado
  ports:
    - "6543"
    - "51000:51000"   # for ptvsd debugger
  env_file:
    - ./portal.env

I also had no luck finding the complete list of possible keywords available in .devcontainer.json. Can anyone point me in the right direction?


Update: Found the keyword reference for .devcontainer.json

1

2 Answers 2

1

Got a response in the Github ticket:

"When attaching to a running container it is not known what your current workspace folder is. Therefore the user has to pick the folder."

So, attaching to a contaioner and then automatically opening a specific folder isn't possible, it seems. But I discovered that F1 Remote-Containers: Reopen Folder in Container roughly gets me where I want to go.

Sign up to request clarification or add additional context in comments.

Comments

1

F1 Remote-Containers: Open Named Container Configuration File

{
  "workspaceFolder": "/ado"
}

Then save, close the window and reattach it to the container.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.