5 ms·
Doing 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
by onion2k 6y ago
Doing 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 agoSame problem with PHP development, anyone trying to develop on windows for any real world framework will have epic IO lags, sometimes crashes with composer (equivalent to npm) and ALSO during execution time. Is this composer/PHP/Symfony-Laravel-whatever's fault ? Is it the caching lib fault ? I work on linux, but try to onboard windows dev frequently ("windows dev", ikr ;) . The experience is always painful, and despite many efforts from the WSL team to move forward, docker for development on Windows is still barely usable right now ...
- lpasselin 6y agoHave you tried docker on Windows? It's even worse. On OSX I only had problems with GUI running in docker. I was used to sharing X between linux host and docker container also running linux. For some projects, the only working solution I found was to run a VNC server in docker. Specific example: in a docker container, run a GUI built with Kivy and view the window on the OSX host. If anyone manages to do this without VNC, I'd like to know how!
- nickjj 6y ago> Have you tried docker on Windows? It's even worse. I've been running Docker on Windows since Windows 10 17.09 or roughly the time WSL 1 came around. That's since October 2017. It's been really fast and stable here and now with WSL 2 it's even better. There hasn't been a single Flask, Rails, Phoenix or Webpack related project I've developed in the last 3+ years where I felt like Docker was slowing me down[0]. I'm using a desktop workstation with parts from 2014 too (i5 3.2ghz, 16gb of memory and a 1st gen SSD). About a month ago I made a video showing what the dev experience is like with this hardware while using Docker[1]. Code changes happen nearly instantly, live reloading works and even Webpack happily compiles down 100s of KBs of CSS and JS in ~200ms (which could further be improved by using Webpack cache). [0]: The only exception to this is invalidating cached Docker layers when you install new dependencies. This experience kind of sucks, but fortunately this doesn't happen often since most changes are related to code changes not dependency changes. [1]: https://nickjanetakis.com/blog/for-the-time-being-16gb-of-ram-for-web-development-works-really-well https://nickjanetakis.com/blog/for-the-time-being-16gb-of-ra...
- GordonS 6y agoAlso been using Docker on Windows 10 since around the 2016/2017, and also had no issues with speed - it works marvellously!
- tmpxgdqrcKFuG 6y agoThe problem is "technically" still there in Windows it's just that Microsoft decided to push things along by creating WSL which essentially puts Linux (with Linux Containers) on Windows. The Windows solution is the equivalent of Smart Hulk figuring out time travel. I'm not saying it's not good, because it is.
- adamkl 6y agoTo make it workable I had to just give up on the local host file integration. I basically used the container like a VM. Configured it with all the tools I normally use (e.g. OhMyZsh, etc) and had it constantly running in the background. I would use VS Code as a front end and work directly inside the container (cloning repos and pushing commits). It had its quirks but the main benefit was that my local machine was no longer a snowflake. I could easily move to any machine, pull my "development" image, spin up the container and everything was exactly as I liked it.
- IggleSniggle 6y agoWhat would be the advantage of this setup over a traditional VM where you presumably have more portability of the stateful image?
- ItalyPaleAle 6y agoSpeaking for myself, containers are started and destroyed faster. When using VMs, the tendency is to keep updating the software within the VM, making changes to their state, etc: this eventually leads to drifts. When using containers, if you need to make a change, you destroy the container and re-build it, and the state is always consistent with what you (and possibly your teammates) use
- Shicholas 6y agoas an addition to do this, we've found it easier to spin up the same exact environment for CI/CD.
- adamkl 6y agoTo be perfectly honest, in this scenario, there isn't much of an advantage. The container approach is lighter weight, and I found it easier to manage the configuration via Dockerfiles. Managing a full VM with the OS install is a bit of a pain. That being said, I worked at an organization that did the VM approach using Vagrant. It wasn't as nice as the VS Code/Docker approach, but the results were similar.
- 6y ago
- cpuguy83 6y agoI use vscode to connect to a a cloud vm. VSCode is surprisingly good at this. Client is local and connects to an vscode server over ssh. Granted I work on Azure and the cost of the vm is not something I have to worry about.
- speedgoose 6y agoThe Azure Codespaces VMs were awfully slow on IOs. It was not a great experience at all. If you want decent IOs, better than an old notebook, Azure is extremely expensive.
- TimTheTinker 6y agoI do this, but with a Linux VM running in Parallels on my Mac. Uses about 1/10 the CPU that Docker on Mac uses for the containers I run.
- seabrookmx 6y agoSame here, but with Hyper-V on Windows. Originally I did this because of bad performance and bugs in WSL 1. I hear WSL 2 is better but I already have it all set up and it works great for me so I've just kept it.
- gingerlime 6y agoWe also use remote dev boxes, but can VSCode connect to a remote server and connect to remote docker containers? For example, I don't have ruby installed on the remote dev box, but it is installed inside docker on the remote host. I also don't have ruby or docker running locally. I think all the linting plugins either expect ruby to be available on the remote host, or inside docker, but not this combo... Is there something I'm missing? (disclaimer: only played a bit with VScode, I use vim on the remote box usually).
- brianm 6y ago> can VSCode connect to a remote server and connect to remote docker containers? Yes, it can. 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... talks about setting it up.
- efficax 6y agothe solution to this is to enable NFS for your volumes. The default volume configuration is a huge bottleneck for docker on macos
- deergomoo 6y agoAlthough be aware, if you add shares to nfs.conf, your Mac will no longer sleep while connected to power, even if you close the lid. Not sure if there's a way around it, but I was sitting down at my desk every morning to find a toasty laptop, lid closed and fans blaring.
- blopker 6y agoThere's a volume feature that sped up disk access to mounted volumes quite a bit. You add ":cached" to any volume. This changes some of the guarantees around consistency, but I haven't had any issues. See https://www.docker.com/blog/user-guided-caching-in-docker-for-mac/ https://www.docker.com/blog/user-guided-caching-in-docker-fo...
- ihuman 6y agoIsn't Docker using virtual machines on macos?
- carlosf 6y agoNot sure about OSX, but in Windows 10 + WSL 2 Docker development can be made faster by cloning code directly to a volume.