How to Get VSCode Running Inside a Docker Container?

September 17, 2025 2 answers
Asked by TechieGiraffe92
I'm attempting to run Visual Studio Code within a Docker container. I've started the container with a variety of options, such as using `--privileged`, `--network host`, and more. Additionally, I've mounted some necessary sockets from the host and set several environment variables for X11. While VSCode launches fine, I run into problems when trying to install extensions, receiving a 'Failed to fetch' error. Interestingly, when I try to `curl` the same URL that fails in VSCode, it works perfectly. Given that I started the container with `--network host`, I expected the network would pass through without issues. Does anyone know what might be going wrong?

Answers

CuriousCoder77
It sounds like you're facing some network permission issues within the container. Have you checked the proxy settings inside your container? Sometimes, even with `--network host`, applications like VSCode might need specific configurations to access the internet due to Docker's isolation features. Try setting the `HTTP_PROXY` or `HTTPS_PROXY` environment variables if that applies to your network setup.

TechieGiraffe92: I haven't looked into that yet! I'll give it a try and see if it resolves the fetching issue.

Reply to this answer
DevOpsNinja88
Instead of trying to run standalone VSCode, you might want to consider using `code-server` from Coder. It's designed to run VSCode in a server environment and can handle such setups more smoothly, especially in multi-developer scenarios.

TechieGiraffe92: That's definitely an interesting option! I'm aiming for a solution where various IDEs can work seamlessly within the same environment, but I'll keep `code-server` in mind.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions