Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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 ;)



Of course, now you have to boot and run an entire VM on your MacBook, just to run that one Node.js program.


Ah 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 :)


As if docker doesn't run a VM on Linux when you invoke that one liner.


It doesn't


Official 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


It 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.


"Merely".

As in: "a completely different node js binary in its own environment, its own networking, its own file system overlay etc."


I 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.


Being a developer!== Linux.


Interesting theory ;)


Easily 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.


I'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.


Depends if one is stuck in the glory days of UNIX, or has already learnt to embrace native cloud development.


In 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.


Not when the cloud is running servless and language runtime containers on top of type 1 hypervisors.

Zero POSIX.


All 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.


No 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-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...


You know that serverless is orthogonal to unikernels, right? Serverless just means dynamically provisioning an instance in response to the load balancer seeing a request. There are no serverless runtimes I know of that don't run as relatively regular processes on a host kernel.

> Additionally, bare bones Linux kernel infrastructure for Xen and KVM support isn't UNIX.

> "Transcending POSIX: The End of an Era?"

Xen and KVM aren't equivalent here.

KVM is ultimately an interface involving file descriptors, mmap(2), read(2), write(2), etc. IMO while not being UNIX™ it still very much embodies the UNIX spirit.


If 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.


Not on Windows. We have native containers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: