16 ms·
VSCode, Dev Containers and Docker
- rhacker 6y agoAssuming wordpress/php/mysql/shitball happened
- dsissitka 6y agoMirror: https://web.archive.org/web/20210121151535/https://blog.feabhas.com/2021/01/vscode-dev-containers-and-docker-moving-software-development-forward/ https://web.archive.org/web/20210121151535/https://blog.feab...
- kkapelon 6y ago...or you could use https://codeanywhere.com/ https://codeanywhere.com/ https://gitpod.io/ https://gitpod.io/ https://codesandbox.io/ https://codesandbox.io/ https://codenvy.com/ https://codenvy.com/ for a more streamlined experience...
- easton 6y agoI don't know what could be more streamlined than clicking "Code -> Open in Codespace" on GitHub, and Visual Studio Code renders in your browser, with all of your dotfiles set and dependencies loaded to mess around with something. (GitPod does a similar thing where you can append the URL to gitpod.io, but they can't use the VSCode extension marketplace).
- kkapelon 6y agoCodespaces is in private beta. I have requested access for some time now and got no response. All the services I mentioned are fully open for everybody today.
- sebastos 6y agoUnless, unimaginably, you need to keep your code on-prem... I know, I know. Unthinkable.
- kkapelon 6y agoI haven't tested, but I think gitpod works with on-prem installations.
- jankeromnes 6y agoYes, Gitpod is open-source and can be self-hosted: https://github.com/gitpod-io/gitpod/ https://github.com/gitpod-io/gitpod/
- ducktective 6y agoDoes this deprecate my vim/gcc/gdb/make (in general "CLI driven workflow") which I have assigned so much time to, to have a nice vender/IDE-independent solution for development? I'm curious to know the answer in an honest/practically-speaking sense not ideologically. IMO, the downside of this container/web-app solution is the memory size that all the SDKs would need and this would add up eventually. But I'm not sure this fact alone could win any hearts over that sweet ease-of-entry-to-development. People were nagging about latency and bloat in webapps and Electron GUIs...yet here we are...even SpaceX's console is a chromium instance.
- shadowgovt 6y agoProbably not, but your vim/gcc/gdb/make flow doesn't scale to other developers. If it works for you, by all means keep using it.
- Shicholas 6y agoyou can still have a shared base Image for your teammates, then use that base image to create a new image just for your .vimrc etc.
- shadowgovt 6y agoI meant more that by modern standards, vim/gcc/gdb/make is a very labor-intensive toolchain to write applications with. "Doesn't scale" in the sense of "other developers are pretty unwilling to learn that chain of they didn't grow up with it."
- CrazyPyroLinux 6y ago> "other developers are pretty unwilling to learn that chain of they didn't grow up with it." Funny, I've been running into this problem while trying to switch people to docker. Maybe we're all a bit guilty of this in our own way.
- fantod 6y ago
- mhoad 6y agoI've been doing some playing around with dev containers for a while now and am loving the experience so far. The one thing I am not super clear on however is doing end to end browser based testing in Web Apps. I didn't find a lot of good documentation on this currently. I can't tell if the "correct" solution is to also load something like headless chrome into the Dockerfile and install it manually or go down the path of trying to set things up in a different container with a docker-compose approach.
- htatche 6y agoA headless chrome works for testing. You can even open GUI apps (at least with X11 on Linux) from the container itself, and it will use the host's X session (chrome --no-sandbox). I've been using a containerized Rails app with VSCode for a while now and absolutely love it.
- mhoad 6y agoYou wouldn't happen to have an example Dockerfile you could share at all would you? The examples I have come across online so far did't look super straightforward.
- Shicholas 6y agoWe found website testing inside a Docker container to be tough, so we still run Cypress on a native machine, but our web process is still ran within the Docker container. In CI, we use the default Cypress GitHub action which runs on the CI native system, and all of our servers are spun up with docker-compose. Source: https://github.com/NeonLaw/codebase/blob/development/.github/workflows/continuous_integration.yml#L52-L57 https://github.com/NeonLaw/codebase/blob/development/.github...
- onion2k 6y agoDoing any sort of development with Docker on OSX can be painfully slow if you have a lot of files that change frequently. There are a few projects to improve it but they quite aren't there yet. It's my least favourite aspect of modern web work.
- misiti3780 6y agoAgreed, try running webpack in debug mode with watch it's basically not-usable, as is git and install npm packages.
- GiorgioG 6y agonpm / webpack: That's not Docker's fault - that's node/JS's fault. Having to touch thousands and thousands of files is expensive. This is why I've come to loath web frontend development.
- commandlinefan 6y ago> I've come to loath web frontend development. Well, we don't have to do things this way just because everybody else does... developing "vanilla" Javascript is actually a pleasure especially with tools like Chrome's debugger. In my experience, front-end "frameworks" like Angular and React provide very little value and tons of unnecessary overhead.
- potta_coffee 6y agoShow me the team that's using vanilla JS, I'd like to sign up.
- onion2k 6y agoIt's definitely Docker that's the problem. It's a well known problem, and people are working on solutions. It affects far more than NPM and Webpack.
- Maer4life 6y ago
- marcus_holmes 6y agoI understand this can be done. And this post explains how it's done. I still don't get why it should be done? What's the advantage of running your dev environment in a container?
- kkapelon 6y agoIf you have projects with different versions (python2/3, Java5/8, node8/11 etc) you don't need to bother with version managers and package managers anymore. Just launch the respective container and you are good to go.
- misiti3780 6y agofor python, why cant you use use virtualenv with pyenv?
- miscaccount 6y agobecause setting and configuring virtualenv is also chore and loads of things that can go wrong. Its different in windows to mac to linux. With docker its a single command run after installing docker.
- TeMPOraL 6y agoYou could, but then maybe you have some editor-specific settings you'd also want to tie to particular project. And if you're working with multiple projects in multiple languages, why bother learning each language's equivalent of virtualenv (assuming it has any), when there's an universal method available?
- kkapelon 6y agoBecause it is a Python specific thing. Docker works with all programming languages and that's it. If you are full stack or work with multiple programming languages there is no need to learn the "equivalent" of virtualenv everywhere else. Also with docker there is no setup/installation involved. You just pull the image and that is it. Also virtualenv requires that you already have pip/python installed. Docker requires nothing (apart from itself). So you can instantly launch Java/Node/Erlang/Haskell whatever without any SDK/libs installed.
- dhruvrrp 6y agoSlightly off-topic, it really irks me when people take about reproducible builds/environments while using docker, while having something along the lines of apt-get update/pip install in their dockerfile. Like that completely destroys the reproducibility of your container!
- outside1234 6y agoAnd by that you mean that the version of those deps aren't pinned?
- beagle3 6y agoYou depend on what the repository serves for "apt-get". You may pin it, but it still doesn't guarantee you're going to get the same version if it was replaced on the repository without changing the version.
- dhruvrrp 6y agoAt least for python, just pinning the top level dependencies are not enough. if you pin tensorflow==2.4.0, it doesn’t pin its required packages, rather it just defines a range. An example would be tf will try to get wheel>=0.26 (which was released in 2015 and is currently on release 0.36.2)
- kiallmacinnes 6y agoYea - I get where you're coming from - you can't rebuild the container, but each team member can reuse the same container - which is at least a step towards being fully reproducible.
- mumblemumble 6y agoI can't speak for others, but, while we don't pin versions in the Dockerfiles for our build container images, we do version the images themselves. Reproducibility is a continuum, not a binary. We've chosen a point on that continuum that we believe gives us the best trade-off between reliability and maintenance effort. 100% from-the-ground-up reproducibility would be ideal, of course, but there's a cost-benefit tradeoff, and we're not being paid to be perfectionists.
- gspr 6y agoA little bit off-topic, but I hope it's relevant enough: can someone who's well-versed in Docker give me some pointers as to how I can use it in a better way? Let me elaborate. I'm a bit of an old fart when it comes to software development. I prefer stable, slowly evolving solutions. I am a fan of the role of classical distributions. I abhor bundling every piece of software with all its particular versioned dependencies until everything works. I'm not gonna change. And that means I'm probably not the type to use Docker to deploy anything. That being said, I do see great value in it as a way for sysadmins to let semi-trusted people run their own OS on shared hardware without stepping on each other's feet. I love that it lets all of us run each our OS of choice on our compute machines at work. But that's just it: when I use Docker, I pretend it's a VM. I really would like to learn to use it in a better and more appropriate way, but whenever I try to seek out information, quality search results are absolutely covered in garbage 10-second-attention span "just type this until it works" blogposts. Any pointers? (Alternative question: are there some cleaner solutions than Docker out there for the workflow I describe above?)
- kkapelon 6y agoYou are confusing two different things. One is using Docker as a deployment packaging method. The other is using Docker only for development and still deploying traditionally. Sure you can do both, but it doesn't have to be this way. >when I use Docker, I pretend it's a VM Also check anti-patterns 1 and 4 here https://codefresh.io/containers/docker-anti-patterns/ https://codefresh.io/containers/docker-anti-patterns/
- gspr 6y agoAnti-pattern 1 perfectly describes how I am (hamfistedly) using Docker. Thanks! However, it doesn't really explain how to fix my mindset. It just says that I should ;-) Could you give me some hints?
- kkapelon 6y ago"There is no easy fix for this anti-pattern other than reading about the nature of containers, their building blocks, and their history (going all the way back to the venerable chroot)." Basically learn the basics (cgroups, namespaces) You should also study this https://github.com/p8952/bocker https://github.com/p8952/bocker
- durnygbur 6y agoThrow in Azure with k8s and MS sales department will organise a "training" for the managers on Caribbean or Ibiza.
- lpasselin 6y agoOne slight problem I had with .devcontainer in VS Code was running the devcontainer on a remote ssh server. Remote SSH works. Local devcontainer works. But mixing the two requires configuring the docker engine settings to point to the remote. This forces other projects to also run on the remote machine. This was a problem as of 2 months ago.
- 0x008 6y agoDoes this help? https://code.visualstudio.com/docs/remote/containers-advanced#_developing-inside-a-container-on-a-remote-docker-host https://code.visualstudio.com/docs/remote/containers-advance...
- lpasselin 6y agoThis is what I used (combined with stackoverflow posts) to try it.
- darkteflon 6y agoIs it not possible to set the Docker host to the remote machine under your project workspace settings only, instead of in global settings?
- deleted 6y ago[deleted]
- UweSchmidt 6y agoAs amazing and convenient as Docker is in practice, containers hide the inherent mess that is modern computing, and the more they are used, the less chance is that this mess is getting cleaned up... ever. Ultimately this is another dependency, complexity hidden by another layer...
- gameswithgo 6y agoagreed. that docker is needed represents a failure of our industry
- Silhouette 6y agoI'm not sure I quite agree with that. Having a controlled environment in a sandbox of its own clearly has benefits, both for consistency of what you're running and for safety if it doesn't work as you expected. It doesn't need to be Docker specifically that we use to create such an environment, but if not Docker then we'd surely have looked for some other way to achieve the same result.
- topspin 6y agoDocker is literally the specification of all the missing parts of the operating system. It's not a very good specification, but it is fairly comprehensive.
- zackmorris 6y agoAfter learning Docker, I second this. The great mistake happened way back in the 1980s (maybe earlier) when most OS developers didn't implement a proper permissions system for executables. Basically, the user should always be prompted to allow a program read/write access to the network, the filesystem and other external resources. Had we had this, then executables could have been marked "pure" functional when they did't have dependencies and didn't require access to a config file. On top of that, we could have used the refcount technique from Apple's Time Machine or ZFS to have a single canonical copy of any file on the drive (based on the hash of its contents), so that each executable could see its own local copy of libraries rather than descending into dependency hell by having to manage multiple library versions sharing the same directories. Then, a high-level access granting system should have been developed with blanket rules for executables that have been vetted by someone. Note that much of this has happened in recent years with MacOS (tragically tied to the App Store rather than an open system of trust). There is nothing in any of this that seems particularly challenging. But it would have required the big OS developers to come on board at a time when they went out of their way to impose incompatibility by doing things like: using opposite slashes and backslashes, refusing to implement a built-in scripting language like Javascript, or even providing cross-platform socket libraries, etc. The only parts I admire about Docker are that they kinda sorta got everything working on Mac, Windows and Linux, and had the insight that each line of a Dockerfile can be treated like layers in an installer. The actual implementation (not abstracting network and volume modes enough so there's only one performant one, having a lot of idiosyncrasies between docker and docker-compose, etc) still leave me often reaching for the documentation and coming up short. That said, Docker is great and I think it was possibly the major breakthrough of the 2010s. And I do love how its way of opening ports makes a mockery of all other port mapping software.
- chaganated 6y ago> Docker + "Moving Software Development Forward" Oh! My sides!
- aaccount 6y agoContainers promote bad software development.
- switch007 6y agoFor example?
- taeric 6y agoThis feels like a case study in how to take an anti fragile system, and just make it fragile. As much as it is a bunch of small paper cuts to support varied developers, you are more resilient to a big shift.
- 0x008 6y agoWhile I love that VSCode can do this and I would like to appreciate a post about the topic, I wonder if I should upvote a blog post that adds almost no value over the existing VSCode documentation which is basically excellent already and covers every use case I ever stumbled upon.
- maxired 6y agoSite seems down, here is the archived version http://web.archive.org/web/20210121151535/https://blog.feabhas.com/2021/01/vscode-dev-containers-and-docker-moving-software-development-forward/ http://web.archive.org/web/20210121151535/https://blog.feabh...
- dalu 6y agoDo you know the acronym ABM? If you're not a native German speaker, probably not. Arbeitsbeschäftigungsmaßnahme. Docker, k8s ... it's all there to employ the unemployed. Also to make something simple complicated so Cloud providers can monetize even this part and lock you in and bill you 10fold for something that really isn't that expensive
- ohthehugemanate 6y agoThis is the killer feature that keeps me on the proprietary version of VSCode. Makes my life so much easier!
- threesmegiste 6y agoWhy dont we develop on production server ???
- scruple 6y agoI'm not quite sure that I understand the advantages of doing development work inside of the container. What am I missing?
- rusticpenn 6y agoThere are many advantages of containerized development. One example would be the protection of root environment from version pollution. My team uses and supports 3 versions of a framework, how do I test and develop in all of them without one environment affecting the other?
- d3nj4l 6y agoOf course, you could use a version management tool like nvm/rvm/asdf etc, but I think containerisation is also a neat alternative, as you would be able to use multiple versions for languages/tools and libraries within those languages for which a version management tool doesn't exist.
- millstone 6y ago"3 versions of a framework" is quite vague. Are those versions Linux/Windows/Mac? Because then Docker is not very useful. Docker is not a general solution to this problem because it ties you intimately to Linux, whether directly, or through VMs, or compat layers.
- bloody-crow 6y agoLet's say you maintain or occasionally code several big webapps in Ruby. One uses Ruby 2.4 and Ruby-on-Rails 3.2, another uses Ruby 2.6 and Ruby-on-Rails 5.2, and the last one is bleeding edge using Ruby 3.0 and Rails 6.1 Having all versions of you language and framework installed top level is a huge pain in the ass, since they inevitably will interfere with each other. Having separate containers with all necessary dependencies in it for each app is a lot more manageable.
- ckolkey 6y ago
- mintyc 6y agoTo be truly portable it is worth considering whether your newly created Dev environment can work without the internet or in an air-gapped environment. Vscode can be problematic in that respect. Typically with dependencies used by an extension often assuming they can reach out to other servers. I look at initial internet facing container creation as a separately managed snapshot process to grab dependencies which then gets configured for particular Dev, build, test, runtime and release containers that are built by the dependency collecting original container. Ie something like vscode isn't installed in the internet facing container, it is installed in the offline build of a Dev container. This is where the difficulties lay in my approach.
- xomodo 6y agoLooks like gitpod to me: https://github.com/gitpod-io/gitpod https://github.com/gitpod-io/gitpod