3 ms·
Something along the lines of > docker run -it --rm -v "$PWD":/app -w /app node:18 node main.js It's a tad longer but it's more flexible too ;)
by forty 3y ago
Something along the lines of
> docker run -it --rm -v "$PWD":/app -w /app node:18 node main.js
It's a tad longer but it's more flexible too ;)
- paulddraper 3y agoOf course, now you have to boot and run an entire VM on your MacBook, just to run that one Node.js program.
- forty 3y agoAh yes, I always forgot some people don't use Linux as their OS to develop. That always seems weird to me because then they have to launch VMs each time they want to simulate their target OS :D But I do see your point :)
- pjmlp 3y agoBeing a developer!== Linux.
- forty 3y agoInteresting theory ;)
- pjmlp 3y agoEasily proven by happy consumers on Apple, Microsoft, Sony and Nintendo devices. Or the millions of daily passengers in transport mechanisms powered by high integrity operating systems.
- forty 3y agoI'm kidding of course. But in the specific context of this thread which was Nodejs backend development, I'd still maintain that not using Linux to develop is suboptimal.
- pjmlp 3y agoDepends if one is stuck in the glory days of UNIX, or has already learnt to embrace native cloud development.
- forty 3y agoIn a way, the glory days of Unix, with users using shared infrastructure is closer to cloud than using Linux locally, which gives you freedom, independence and privacy.
- pjmlp 3y agoNot when the cloud is running servless and language runtime containers on top of type 1 hypervisors. Zero POSIX.
- monocasa 3y agoAll of the major serverless runtimes are running on top of Linux by default. And almost all systems on AWS are running on Linux/KVM. Even quite a few that report as Xen are actually running on KVM; Amazon added a bunch of code to KVM to lie on guest hypervisor cpuid leaves as well as emulate Xens hypercall interface.
- pjmlp 3y agoNo they aren't, if the cloud in question is Azure, as Hyper V doesn't need a kernel to make it work. The controlling OS is a guest as well, with additional privilege. Which happens to be a special Windows build, Azure Host OS. https://techcommunity.microsoft.com/t5/windows-os-platform-blog/azure-host-os-cloud-host/ba-p/3709528 https://techcommunity.microsoft.com/t5/windows-os-platform-b... Additionally, bare bones Linux kernel infrastructure for Xen and KVM support isn't UNIX. "Transcending POSIX: The End of an Era?" https://www.usenix.org/publications/loginonline/transcending-posix-end-era https://www.usenix.org/publications/loginonline/transcending...
- troupo 3y agoAs if docker doesn't run a VM on Linux when you invoke that one liner.
- evnix 3y agoIt doesn't
- troupo 3y agoOfficial docker image for node is built from Alpine or Debian [1] Forgive me if I don't believe that running a full OS on a host OS to run a single node command doesn't amount to running a VM. [1] https://github.com/nodejs/docker-node/tree/main/20 https://github.com/nodejs/docker-node/tree/main/20
- bombela 3y agoIt doesn't run a full OS. Merely the nodejs binary with all it's dependencies. You can think of Docker containers as a way to package an application dependencies, ending at the (Linux) kernel API/ABI.
- troupo 3y ago"Merely". As in: "a completely different node js binary in its own environment, its own networking, its own file system overlay etc."
- forty 3y agoI cannot say if your are wrong because of ignorance or bad faith, but in case it's the former: running in a container is not the same as running in a VM, no rewording of the definition of either will make it the same or even equivalent. The difference have some impact on performance and security among other things, I recommend that you take the time to understand the difference if it's a topic of interest for you.
- tracker1 3y agoIf you're using Docker Desktop, and have it run at startup, that VM is already running when you launch your docker command. It's not like you have to start a new/fresh VM every time you do docker run.
- pjmlp 3y agoNot on Windows. We have native containers.