To make it clear: you need to use
code --folder-uri vscode-remote://attached-container+<X>/workspaces/bla_bla`
where X is containerName in hex encoding.
Container name is this one:


Literally name of container(not always biggest label in GUIs).
You can find it in docker inspect json in field "Name".
Slash at the beginning doesn't matter(can be or not).
To make conversion to hex use online converters, or maybe set /a on Windows (I don't think it's gonna work) or
printf some_name | od -A n -t x1 | tr -d '[\n\t ]'
on Linux(get from here)
or you can use bash(like Git Bash)
or use some cross-plattform-ish solution from Geir
If you want to specify more(like Garrett) than name - encode json with container settings
Like this
printf {\"conainerName\":\"ecstatic_shamir\",\"settings\":{\"context\":\"desktop-linux\"}} | od -A n -t x1 | tr -d '[\n\t ]'
and put encoded hex number in X.
Don't forget to escape quotation marks in json with backslash "\".
If you want to start container at first - try to replace
attached-container with dev-container
You can probably use Id instead of Name in X, but it already in hex(do I need to encode it again?), and should i use full version or just short?
My Windows desktop icon to start VSCode with docker container now looks like:
"C:\Program Files\VSCode\Code.exe" --folder-uri vscode-remote://attached-container+2f65637374617469635f7368616d6972/workspaces/sapfor
where X is printf ecstatic_shamir | od -A n -t x1 | tr -d '[\n\t ]'
devcontainer.json, so the uri containedattached-containerinstead ofdev-container, so the command was:code --folder-uri vscode-remote://attached-container+7b22636f6e7461696e65724e616d65223a222f70726963656c6573735f686f70706572227d/app. Replacing the container id with the container name was similar, so I got an error message with id or name being shown as garbage. But a prompt appeared asking to choose a running container, and from there it was possible to attach the wanted container.