I try to run my Visual Studio code in a container using "Remote-Containers: Reopen in Container". For this I have the following folder structure:
.devcontainer/
devcontainer.env
devcontainer.json
Dockerfile
certs.pem
I can build the docker image without problems, but I can still not create the container, as there is a problem downloading and hence installing VS Code Server:
Support for Alpine Linux is in preview.
[14250 ms] Start: Run in container: test -d /home/<name>/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0
[14252 ms]
[14252 ms]
[14252 ms] Exit code 1
[14252 ms] Installing VS Code Server for commit 26076a4de974ead31f97692a0d32f90d735645c0
[14252 ms] Start: Run in container: mkdir -p /home/<name>/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1590499133646
[14254 ms]
[14254 ms]
[14254 ms] Start: Downloading VS Code Server
[15315 ms] Failed to download VS Code Server (https://update.code.visualstudio.com/commit:26076a4de974ead31f97692a0d32f90d735645c0/server-linux-alpine/stable): HTTP 407 - authenticationrequired
So then I tried to do this manually as suggested here by jia2 and cliffburdick: https://github.com/microsoft/vscode-remote-release/issues/78.
So I added the following lines to my Dockerfile:
RUN mkdir -p /home/<name>/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1590494378070 &&\
cd /home/<name>/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1590494378070 && \
curl --proxy "http://<user>:<pw>@<company_domain>:<port>" --cacert /home/certs.pem -L https://update.code.visualstudio.com/commit:26076a4de974ead31f97692a0d32f90d735645c0/server-linux-alpine/stable -o vscode-server-linux-alpine.tar.gz &&\
tar -xzf vscode-server-linux-alpine.tar.gz
Now the problem is that VS Code still tries to make the folder above to install VS Code Server and complains (of course!) that it already exists:
[14142 ms] Installing VS Code Server for commit 26076a4de974ead31f97692a0d32f90d735645c0
[14142 ms] Start: Run in container: mkdir -p /home/<name>/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1590496132128
[14144 ms]
[14144 ms] mkdir: can't create directory '/home/<name>/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1590496132128': Permission denied
[14144 ms] Exit code 1
[14146 ms] Command in container failed: mkdir -p /home/<name>/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0_1590496132128
Also according to SSH with VSCode without internet this should work, but apparently it does not. I am not sure if I could solve it via Permanently install VS Code's server in container, as I am not really familiar with docker-compose yet. I would appreciate any suggestions to try-out or pointers to mistakes I made.