Ever tried to use Docker volumes for hot-reloading in your web app? If you had the same horrible experience as me, you will enjoy the newest featur...
For further actions, you may consider blocking this person and/or reporting abuse
Hard to believe there are people out there developing their apps in containers.
I would personally say goodbye to Docker (for developing) instead.
For me there is today no other ways than using Docker containers. I'm working in a team and since I've introduced docker the " it doesn't work on my machine" didn't exists anymore.
And since all settings are in docker, a new colleague just need to run a very few commands and he can start to code.
I'll no more work like previously. Docker all the time for me.
This can be achieved without Docker via env managers, nix, or even just smart setup. When settings can live in docker files they can also live elsewhere
Sorry I disagree. Using Docker I can create my own Docker images where I can foresee everything like, for PHP, each PHP modules to load, how they should be configured and so on. Then just give my docker-compose.yml file (and associated Dockerfile files) so everyone has the perfect setup.
Everything correctly configured, everyone using the same versions of tools and when I'll update f.i. php from 8.2 to 8.3 it'll be done for everyone at no cost. I'll make the change and everyone will get the newer version with no effort.
Docker has totally change how we're working.
I can see this is more complicated with stacks like that. Still you don’t need Docker for that. Nix will do that just fine for you, without containers. Now I’m personally not a huge fan of nix, but there are others too, it’s not limited to containers.
Docker is great for distribution, deployment, testing, having requirements to run many things together, but for a little bit of environment, setting and package management it’s like using an elephant to catch a mouse :)
With all complexion and issues like watchers and networking involved. Especially on non native systems like Mac and Windows.
That said, if it works for you/team, then it is hard to argue. It is the most important factor.
Here too, I didn't agree since, under Windows, we can use WSL2 (Windows Subsystem for Linux).
I should admit I don't even what Nix is (and I'm not really curious about since Docker fullfill my needs right now).
We (my team) are using Docker on Windows machines, in a WSL2 environment. We're coding a major PHP application with a lot of dependencies, we've a backend, an api, a front using VueJS3, we've PostgreSQL and MySQL db, ... and everything is configured using Dockerfiles and a few docker-compose.yml ones.
Our projects are stored in our, self hosted, Gitlab environenment and all actions are available using a makefile so, when someone need to do something (like running pgadmin for instance), he didn't to remember which command to ... it's just
make somethinglike, here,make pgadmin.All the complexity have been swallowed up by one member of the team, in charge of the maintenance of the framework and the others just enjoy by running very easy
make somethingcommands.Yes, learning Docker is not easy but yes, I would never go back for local development. Everyone has the same installation, no more "it didn't work on my machine", etc.
I just discovered this docker compose watch things. However, I have two services that share the same code base (web and workers). Using docker compose watch makes infinite build and sync issues. because bot services are updating each other. I think I will stick to the volumes until I can figure out that issue :(
Oh interesting, didnt even consider that this might be the case. Thanks for sharing!
Docker for my team is a lifesaver. When you have developers running on Windows, Linux, Mac, x86 / arm architectures. The emulation provided by doctor as well as the ability to package the needed binaries and environments is a must. Many projects have many dependencies that you don’t want to pollute your development machine with. Or cause cross contamination between different projects. I personally have had great success, using host volumes to mount my code into a container for real time changes both inside and outside of the container. I have created a pretty robust docker dev tool GDC
linked in article
What is your 2 sentence pitch for GDC? I'm having a hard time exactly understanding what it does from the GitHub README 👀
My Linked in post in the article sums it up in a bit more than 2 sentences, but let me see if I can condense it a bit more.
At its core It is an IDE agnostic tool which allows you run your IDE locally to edit / debug code that runs inside a container. The GDC works with Windows / Mac / Linux, x86 / arm and many popular languages such as JS/TS, Python, Java, Dot Net, PHP etc.
Let's store node_modules twice on our machines!
Jokes aside, it's nice to have, but I'll probably still stick to volumes, especially on large projects. I can't see how any watcher can be sufficient enough on large codebases. There's a reason all tools exclude 3rd party lib folders, like node_modules from their watchers.
node_modules are excluded from the watch if they are in .gitignore :)
So that's even worse, because I need to install both places anyway to make the IDE work.
Well sure, but with a fast internet connection and enough disk space that isn't really a concern for me luckily:)
Well, enough is quite relative. I have 4TB+ SSD RAID and soon I need to extend again. 60% of space are node_modules :D
Lmao that is impressive
I have been waiting for this for a long time. When teaching Machine Learning, I have opted to use containers to avoid time wasted installing tools on students' PCs.
I disliked mounting, as it was not sufficient, and did not have restart and reinstallation. These will solve 70% of my issues when developing and teaching Python + ML.
Thank you for sharing 🙏🏾
Ohh thats so cool! Hope this works out for you:)
Amazing new feature, thank you for sharing ! Your monorepo example is exactly my setup right now
Nice! I think it's one of the most productive setups I've ever had. Anything that you changed to make it even better? 👀
I would not place the dockerfiles in root of the project. I usually place them inside their associated app path: like apps/frontend/my-app/docker/dockerfiles or /apps/backend/my-api/docker/dockerfiles. This way if you have multiple apps you keep it structured :)
Yeah, I used to do that as well but stopped for some very specific reason that I don't even remember anymore lol. At this point I'm just used to it and with less than 5 apps it's still manageable :)
I think some hosting platform I used didn't really support that when I started with monorepos? Really no reason to still do that I guess x)
I personally work on personal and professional stuff with docker and this its gold to me, thanks
Great read. This is definitely better than using volumes. They were a pain to manage and annoying to integrate with app workflows. Indeed, each framework has a unique set of development challenges and there is no one size fits all, but this new feature helps. It would be good to use some of these rebuild actions in case a basic watch procedure doesn't work.
I hope other dev teams find this soon as it can save them large amounts of time.
Thank you for sharing! Looks like most of my questions are answered in the docs.
Thanks :) Anything that you think I missed that I should've included?
so much hot sexy goodness! save me tons of headaches. holy cow this is good. 😀
It is so neat, thank you for sharing this news!
Glad you liked it!
Why do you need to add your code to the container? When would you need that instead of mount? I have not see dev containers with adding code to the image.
You can find robust version to prevent hacks with watch here jtway.co/running-tests-in-containe...
Compose watch is an amazing addition. There was always an issue with the hot reloading using volumes.
I'm guessing volumes are a problem for non-Linux users. I have no issues with Docker volumes. But non-linux Docker actually runs on a VM. So I can see that could cause problems with hot reloads. 🤔 Good luck guys. 😅
Same here.
After reading the title I was wondering what was wrong with volumes but I'm running Ubuntu so that could be why I have no problems:
yarn watchand code! ^_^Goood
Thanks for your Post.
Nowadays, Developer shall think of working with docker, I personally try to dockerise every application I work on. I have stopped working with vagrant for a while, because of ressources consumption, and many other things.
So for me docker is the most for Dev.
Nos that I can use watch ( sync/rebuild/ sync+), now that I have opportunity ti share my Container with colleagues, I feel more comfortable.
Hopefully there will be a feature to dispatch multiple commands after changing package settings :v it will look like a CD tool in the local environment.
This news is quite impressive; Thanks for sharing it!
Glad that you enjoyed it!:)