20 ms·
Running VSCode in Docker
- black-tea 8y agoWhy on earth would you do this? Docker is such a misunderstood technology.
- colechristensen 8y agoLinux cgroups is such a misunderstood technology.
- coldtea 8y agoAnd so deservedly so.
- kkarakk 8y ago>Why is this useful? You can develop all your code in a fully specified environment, which makes it much easier to reproduce and deploy models and analysis. You can (after enabling security) move your IDE to the data. Instead of transferring data back and forth you can develop where your data is stored. Last - and most important for me - in industries like my own (healthcare), you work with highly regulated data that has to be stored securely, where having multiple copies of data on multiple laptops can pose an unacceptably large risk. Running containers like this within a secure environment with access to the data helps us to have an ideal development environment, while ensuring the protected data remains in a secure, single location with no unnecessary duplication. Article says right there, whereas you haven't explained why this would be a bad usecase? maybe it's wasteful but if a person wants additional security via ephemerality then it seems fine
- nineteen999 8y agoAnd if you need additional security you can run the docker container inside another docker container. https://blog.docker.com/2013/09/docker-can-now-run-within-docker/ https://blog.docker.com/2013/09/docker-can-now-run-within-do... Repeat ad infinitum until you feel secure and ephemeral enough.
- reilly3000 8y agoFrom Coder.com Code on your Chromebook, tablet, and laptop with a consistent dev environment. If you have a Windows or Mac workstation, more easily develop for Linux. Take advantage of large cloud servers to speed up tests, compilations, downloads, and more. Preserve battery life when you're on the go. All intensive computation runs on your server. You're no longer running excess instances of Chrome. I imagine not everybody is going to want to run this on some Kubernetes cluster. The ability to do this locally seems that it could be really productive, actually. And having it in Docker can provide snapshotting via `docker commit` as well as the ability to cap its cpu/ram resources. I might actually try this and a Docker registry to get some semblance of an editor per project. In some contexts I want to run many, many extensions,but for other work I'd rather not have that bloat to contend with. Also I've been really feeling the pain of navigating a PC running Unraid (lots of bare metal VMs) and a Mac laptop, trying to do development on each. My desktop is beefy, but I need to work on the go sometimes, and at times I need to use a Windows box. Right now they all have different VSCode setups. I've been meaning to get around to setting up some scheme of making my config portable, but with different paths across Ubuntu, MacOS, and Windows that seems a bit daunting to get all of my dep paths straight, like eslint and phpcs. Okay, enough comment writing, I'm giving this a go.
- flukus 8y agoSo it's basically installing an IDE on a server and remoting into it? Are docker and VSCode bringing anything to the table?
- reilly3000 8y agoYes and there are a few self-hosted web based IDE options out there. I just happen to like VSCode, mostly for its flexibility and extensions. Docker just makes it convenient to deploy with a run command vs making a local server on multiple machines. I haven’t tried it yet, but being able to snapshot a running machine also seems incredibly useful.
- reilly3000 8y agoSome updates for those who are interested: 1. I first tried to install this on my Win10 VM, which needed to have Docker installed. That was a terrible idea. I completely broke my VM as Docker tried to enable Hyper-V. Friends don't let friends attempt nested virtualization. I should have just run the container on the host instead, which it supports quite well. 2. The repo worked as the blog post described on my mac. Its quick and has been able to run some tricky extensions. I need to experiment with running some external dependancies still. 3. Docker commit worked nicely, making a layer for the changes I made. Still playing with this, but wow that could be very productive if it enabled me to roll back to a tested base environment, or share a full IDE image with somebody on my team.
- coldtea 8y agoTo have the exact environment you are building / tar-getting in. E.g. you can't (easily) have autocomplete in C++ on VS Code on your Mac if your project doesn't target Mac and can't build there (or doesn't have the dependencies etc). But you can do it inside a Docker image.
- binalpatel 8y ago100% right - part of what I wanted to experiment with was being able to share not just code but everything related to the environment (including IDE), and be able to check that into version control as well. So there's little to no friction in mundane setting up tasks like linters/installing packages/messing with config and so on. That being said it's still an idea, but here's hoping it works!
- black-tea 8y agoSo you're going to run a separate copy of an IDE inside a container just so you can target that platform? I think you need better tools.
- oaiey 8y agoI also do not see the purpose in running the frontend in a docker container ... but once you consider the backends I would recommend a read of the Eclipse Che Architecture.
- wetpaws 8y agoRunning docker in docker when
- viraptor 8y agoFew years ago: https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/ https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-d...
- whazor 8y agoIf you want to build docker images in a container you have docker in docker.
- rataata_jr 8y agoWe already have this in GitLab CI. Dind.
- paulcarroty 8y agoFlatpak is much more interested than docker for GUI apps, especially for his sandbox features.
- marcus_holmes 8y ago> Last - and most important for me - in industries like my own (healthcare), you work with highly regulated data that has to be stored securely, where having multiple copies of data on multiple laptops can pose an unacceptably large risk. um... please tell me devs don't have access to production data in a healthcare environment (of all places!). I mean, I understand the need for a representative dataset to develop and test against, but this is people's lives they're playing with! And, you know, if you had a decent set of anonymised or fictitious customer data to work with, you wouldn't need to run your IDE in docker, and there would be less surface area for attackers to get to the data.
- hjk05 8y agoIf you only work with fictitious data, the conclusions of your analysis and models... will be fictitious. Even anonymised date (which most healthcare data is btw.) has strict requirements on access control and copying. As for “develop and test against”. There’s the entire field of data science and modeling that’s not focused with developing systems to expose the data, but doing analysis on the data.
- Tenoke 8y ago>If you only work with fictitious data, the conclusions of your analysis and models... will be fictitious. Not necessarily, there is a lot of work done on synthetic data which closely matches the properties of the real data both in academia and increasingly in industry.
- onion2k 8y agoIf you only work with fictitious data, the conclusions of your analysis and models... will be fictitious. That doesn't have to mean it's worse though. Testing with 10,000,000 fictitious accounts generated to cover lots of permutations of user data is a great idea even if the real data won't ever have some of those permutations. It's a testing technique called "fuzzing", and it's quite common.
- IanCal 8y ago
- herohamp 8y agoThis seems very promising. With C9 being moved to AWS soon, I might look into building an internal version of it powered by launching VSCode instances.
- quaffapint 8y agoWhats the 'best' way people are using to have a total portable development environment that I can reach from home or work? Meaning having vs code, node, all the various cloud local emulators/etc that you would normally install for doing that kind of dev work.
- laughingman2 8y agoEmacs has tramp, which will allow you to remote edit files through ssh with your own setup. You have emacs installed in your computer and you can open any file in any system with ssh authentication inside it. I am running emacs with spacemacs.org
- deleted 8y ago[deleted]
- laughingman2 8y agoPeople who want to work on remote access with restricted setups, checkout Emacs. Tramp mode allows you to edit files over ssh, docker, adb etc without you worrying about anything. And if you haven't tried about Org Mode, it is not exaggeration if I say it is life changing. It can help you organize notes, todos, agendas etc.
- nine_k 8y agoEmacs is great in many ways; I'm saying it as an avid user. For ultimate multi-workplace setup, you can run Emacs in server mode on a cloud instance, and allow network connections to it, or port-forward to its Unix socket via SSH. Now you can run Emacs in client mode from whatever machine you may have, several of them, or ssh to the cloud box and run Emacs in terminal mode in a crunch. All your sessions will share the same set of files, but workspace layout is per client, so you can work comfortably both from an 11" laptop screen and from a 27" 4K screen. As said above, you can use tramp to access whatever other remote files accessible via ssh, and also run a decent (though a bit limited) terminal right from Emacs, to say nothing of running REPLs of all kinds directly, and excellent git integration with Magit. This can even give you a sort of VPN-like access, when the cloud box where the Emacs server runs has access to machines that are not directly accessible to you from the machine you're connecting from. OTOH VS Code likely can be run in a similar setup. In general I very much like the modularization of IDEs: instead of a monolith form 1990s you can mix and match your favorite editor with language servers, REPLs, build servers, etc, all separate and in many cases running remotely.
- jacobush 8y agoFor me (20 years of Emacs), Emacs + Keybase has been what made it into a bit of a productivity tool for me, instead of just an editor.
- jlu 8y agoDoes the keyboard shortcuts for vscode still work inside browser?
- horyzen 8y agoThose that do not conflict with the browser still works. e.g. 'Ctrl + `' to open terminal, 'Ctrl + p' quick open. I'm using Firefox and 'Ctrl + Shift + p' will open a new private browsing page instead of the command palette.
- jlu 8y agoThanks, glad to know that!
- billconan 8y agothere is a bug that you can't config the keyboard shortcuts https://github.com/codercom/code-server/issues/150 https://github.com/codercom/code-server/issues/150
- znpy 8y agoDidn't anyone know it is possible to run a full blown Eclipse in the browser? https://www.eclipse.org/che/ https://www.eclipse.org/che/
- batmansmk 8y agoInteresting case for cloud based IDEs. I really don't understand the localhost use case though. I'm on MacOS. Why would I spawn a VM (docker for macos) with limited access to my system (container promise) to run an editor already running in a VM? I only end up having a resources and disk space hungry, slow and inconvenient editor?
- cheesedoodle 8y agoI'd love to use the VSCode IDE launched from the host and compile C++ code within docker. Is this possible? Currently, I write code in the IDE and compile in the container from the terminal. Imagine that, cross compile from any host in a contained c++ environment. :) Edit: I use CMAKE_TOOLCHAIN_FILE to describe the target env.
- nacs 8y agoCode-server, which OP is building on, should support any language. I've only used it briefly for some node.js work but as the whole thing is just sitting in a normal linux docker container, you should be able to do anything docker/linux can do. https://github.com/codercom/code-server https://github.com/codercom/code-server
- banana_giraffe 8y agoI was just playing with Coder's VS Code fork (what this solution uses for VS Code) the other day [1] I want to love it. It makes a very specific use case I use much nicer. I can leave code on a remote server with all the compute power I need to build and run my project, and edit the file I'm working on with VS code's editor without having to sync files around. It does, however, have a few big caveats that killed it for me. It doesn't block any of the browser things that would leave the webpage. Notably, if you hit Ctrl-W to close a file tab because of muscle memory, you'll close the browser tab. Also, if you hit back on accident like I apparently do all the time, you'll go back to the blank tab page. In both of these cases, you'll lose any unsaved state. Also, the extension repo it's pointing at isn't MS's live repo. There are apparently reasons for this, but it means you don't get the latest version of extensions, which was annoying for a specific extension I've gotten used to. I also had issues with VS Code getting confused about state when my connection to the remote box was less than ideal. All in all, I really wanted to like it, but for truly remote cases, I'm back to using Mosh to interact with the remote box, and a simple tool I wrote ages ago to handle rsyncing the local files to the remote box to build and run them there. [1] https://coder.com/ https://coder.com/
- larrywright 8y agoI played with this too, and was really excited about it... until I discovered that it doesn't work on the iPad Pro (known issue with one of VS Code's core components). It's promising, but it's got a little ways to go.
- znpy 8y agoCheck eclipse che out, it’s so much better.
- alias_neo 8y agoThe title of the article is ever so slightly misleading. It would lead one to believe that VSCode and thus by extension VSCodium could be run in Docker and accessed from a web browser In fact, you can run "Coder" (https://coder.com/); https://coder.com/); a product, which according to their GitHub had some non-trivial effort put into it to make it run as such. Not least of all, looking through their issue list, is the fact they compile extensions themselves and they are therefore somewhat outdated (according to issue comments from their users). It's nice, but it's not VSCode per-se and sadly means no dice for Codium users.