15 ms·
Running Docker on Apple Silicon M1 (Follow-Up)
- simongray 6y agoIt seems contrary to the purpose of Docker to run ARM Linux on the development machine if the server has an x86 CPU.
- jbverschoor 6y agoIt's only one aspect. But this is good a good thing. ARM instances and servers will be used. #savetheplanet
- jmnicolas 6y ago> ARM instances and servers will be used. #savetheplanet You just prolong the agony. Saving the planet means we all go back to middle ages, the rest is feel good wishful thinking.
- xyst 6y agoOff topic but I think we are at the point of no return. Plastic pollution is at its highest with production and use of plastic to increase in significant magnitude by 2050. The main generators of green house gases (US, China) have yet to reduce their reliance on fossil fuels. We are constantly over-fishing, over-grazing, deforesting and plunging this earth of its precious resources with reckless abandon to feed our decadence. World War III won’t be a fight over “values” but rather a constant fight over who controls water, energy, and clean air.
- toyg 6y agoWorld War II wasn't much of a fight over "values" either, that was largely a propaganda device. Certain powers simply wanted more stuff than they already had, and other powers disagreed. Britain declared war when Germany took a Polish port, not when Hitler got in power or when he started rounding up Jews.
- sesuximo 6y agoBritain declared war when hitler took Gdańsk, sure... but after hitler took Czechia and Austria (and funded a coup in Spain). so it’s fair to say Britain’s declaration of war was initially mostly about stopping an expansionist power... but I don’t see how that’s the same as propaganda
- dathinab 6y agoWe "always" had been the point of no return. Or at least for the least 20-30 years. Sure theoretically there was long term a way to salvage it. But it was always unrealistic given the large change in economics and society it requires. But there is a difference between a bad and a even worse situation. So just because we can't reach a perfect outcome doesn't mean we shouldn't try to reach a better outcome. Because of this I really don't like arguments like "we are at the point of no return" as it's often used as a argument that supposedly any improvement is pointless. (Through I think you do not mean it that way). I mean the way we are heading will like not directly lead to a extinction of humans, but it might make live unbearable for most of humanity and it also might prevent us from reaching the necessary tech to survive other extinction events. But this also means that "just making thinks a bit better" can in the long term have a major difference even if it won't prevent a climate catastrophe.
- neolefty 6y agoGoing back _would_ save the planet, but it's not the only way. There are routes forward, but they require global coordination and creativity. It's hard to imagine because there's no historical precedent, but I think it's worth trying for, and I'm confident it's at least _possible_ we can succeed in transitioning to full sustainability.
- markstos 6y agoAdding a sentence to explain how ARM "saves the planet" would perhaps be more effective than a hash tag. I presume you are referring to lower typical power consumption for ARM servers.
- dathinab 6y agoHaving a well defined "fixed" environment (i.e. container), which you can also use to "tryout" some stuff without needing any installations on your system makes this already worthwhile.
- warp 6y agoAWS Graviton instances apparently offer better price/performance compared to intel EC2 instances. So there probably is a slow move to ARM for some developers.
- wfleming 6y agoI would hope that most people's production images are being built & pushed to an image repository in CI, not from somebody's laptop. A lot of the official base images on Docker Hub are dual architecture now (both x86-64 and arm64), so if devs on M1 can build arm64 images locally from those, develop on those, and then have CI build the production x86 image, things should be more or less fine. Of course, I'm sure a lot of people rely on 3rd party base images that are still just x86-64. So I expect there's going to be a pretty painful transition period where Docker works on M1 Macs but a lot of popular images don't. Or maybe Docker's official response will be a Docker for Mac release that still runs x86 in a qemu VM or something, and arm64 Docker on M1 Macs will remain an oddity for a while. But I hope they lean into improving tooling for dual-architecture support, because I think we're increasingly moving into a dual architecture world, and not just because of the M1: as ARM becomes more popular in production, I'm sure more people are going to also find themselves in the opposite situation with x86 workstations & arm64 production servers.
- globular-toast 6y ago> I would hope that most people's production images are being built & pushed to an image repository in CI, not from somebody's laptop. That's not really the point. Cross-compilation is no problem these days, especially for targets like x86-64. The point is rather that devs will be running the code locally in a completely different environment to production which defeats the purpose of using Docker for development.
- klelatti 6y agoIsn't the point that the environment is very close (and the M1 may be a lot faster than a comparable machine) and that the CI will test the final code on x86 before deployment?
- jrrrr 6y agoIt defeats _one_ of the purposes of using Docker for development. I expect that the official M1-supporting Docker Desktop will eventually, given a dual-arch image, allow you to choose which architecture to use. (One would run natively, the other under emulation) There are situations where I'd use this feature, but 90% of the time I'd be fine using arm images locally and deploying x64. (I could also imagine this working the other way -- an x86 dev machine and an arm deployment target -- which I think to some degree is supported by Docker today)
- klelatti 6y agoTo be paired with: "I can't run Arm in the cloud because I haven't got an Arm development machine" You have to break into the vicious circle somewhere :)
- deleted 6y ago[deleted]
- pjmlp 6y agoContainers purpose is not to be CPU agnostic, if you want that use Java, .NET, whatever, and build the container image that pulls the required runtime depending on the host.
- sneak 6y agoA bonus to using command-line docker versus using "Docker Desktop": the former is free and open source software and doesn't include any spyware. The latter is closed source, proprietary, and silently uploads a ton of information about your local system to Docker Inc if it should crash (which is easy to trigger accidentally), including pcap logs of your local network, and a list of all running programs on your system, among other massively intrusive things. Docker Desktop is a privacy nightmare. Always opt for the command line open source docker, and either set DOCKER_HOST="ssh://remote.example.com" in your environment to do remote builds, or run a local VM like this article suggests.
- throwaway888abc 6y agoAlso Running Docker on Apple Silicon M1 - installation https://finestructure.co/blog/2020/11/27/running-docker-on-apple-silicon-m1 https://finestructure.co/blog/2020/11/27/running-docker-on-a...
- tracker1 6y agoOT: But wouldn't be surprised to see Docker Desktop for Mac running on M1 in 3-6 months. Been without a personal laptop for close to a year now, mostly using my work laptop or personal desktop... and have been considering the M1, but likely won't pull the trigger without better Docker support. I've found WSL2+Docker support to be excellent and hope to see similar levels of integration with OSX before too long. Using the CLI to connect to a VM isn't so bad, did this a lot before Docker Desktop was even a thing, though I generally just ran an SSH shelled into the VM full time. With VS Code's remote extension, it's roughly the same either way.
- Wowfunhappy 6y agoI would be surprised if we didn't see Docker Desktop for Mac running on M1 in six months.
- sgt 6y agomacOS already has this and is in fact a proper Unix to begin with. Docker is supported just fine on macOS on Intel (and soon the new chip), and it runs basically Linux inside a VM, just like WSL2 does.
- jillesvangurp 6y agoDocker support with full support for running x86 docker images from docker hub via rosetta would be what is needed for me. I'm not sure that is going to be feasible but not being able to run vanilla x86 docker images means I can't build most server side projects I've worked on in recent years because they all fire up things like elasticsearch, redis, posgresql, etc. as part of their builds so tests can run against these thing. All of those are basically either vendor provided docker images or things on Dockerhub in x86 form. Manually creating arm variants for these things and customizing the builds to have ARM variants is not going to be practical for a lot of that stuff. I'd have an easier time switching to Linux or Windows based laptop than to an ARM mac right now. Realistically, most people that have docker in their life are going to not be bothering with ARM macs for quite some time. In any case, the 16GB limit is also not great if you are using docker, some ide, and other tools. I'd be looking for something closer to 64GB if I was buying currently. Maybe the second generation will be a bit more attractive and maybe by then the software ecosystem will have matured a bit. Right now basically everything I use on a daily basis is somewhat problematic.
- thecolorblue 6y agoI don't understand why someone would want to run docker on Mac OSX (or Windows) in a VM. Is there a way to set up the VM so it doesn't lock memory and processors?
- thecolorblue 6y agoI have been running docker on a 10 year old desktop, running ubuntu, which I ssh into. The code lives on the desktop which I edit over ssh. The desktop can still handle running a db and server, and I don't tie up resources on my laptop. I keep looking for a better solution but this works the best.
- mnd999 6y agoI'm pretty sure that's the only way to run it on Mac OSX. Sure, you can have fancy tools to hide the VM and make it less visible (Docker Desktop), but it's still there.
- pjmlp 6y agoOn Windows yes, use Windows containers instead.
- gitweb 6y agoWindows containers are Windows specific, and the base image is like 1+ GB. I think the best solution is run Linux cause that is what containers were created for and are the most performant on.
- dylanz 6y agoI've never been able to run Docker on my MacBook Pro without the CPU's going crazy and the energy usage skyrocketing. I opened a ticket about it, but there have been other related tickets that have been closed without any real resolution: https://github.com/docker/for-mac/issues/4323 https://github.com/docker/for-mac/issues/4323 It unfortunately prevents me from using Docker for local development. I'm hoping things change with M1.
- tehlike 6y agoDocker on mac is a vm, and things relating to volume mounts are horrendous. Switched to a linux laptop (aero15) and things work now.
- hmcdona1 6y agoyeah osxfs, their solution for syncing mounted file paths, has a massive performance hit. the less files you need to mount in your composes the better. http://docker-sync.io/ http://docker-sync.io/ helps, but docker for mac is still slow.
- dgdosen 6y agoSimilarly, I installed docker-machine and docker (via Homebrew) on my M1 mac via Rosetta 2, and connect to a remote docker host, similar in configuration to this blog post (which really has a misleading title). That works - but it pegs processor usage on the M1 mac...
- wjossey 6y agoFor those talking about wanting to wait till docker support is 5x5, there’s another work around you can go with. Buy the M1 and switch to a fully remote development experience. Spin up a DO instance, wire up VSCode Remote, and run docker on that machine. While it does require an internet connection, I’ve found remote development to be really fantastic as an option on a personal “underpowered” laptop. Especially if you are running a cluster of services or large databases, I find it’s far more productive to offload the running of my code to a VM in the cloud.
- seek3r 6y agoWhy is this getting downvoted?
- untog 6y agoI didn’t downvote but IMO “the way to get this working on your expensive laptop is to buy another entirely separate computer and have an always on internet connection” isn’t really an answer (and isn’t at all specific to the M1).
- reaperducer 6y agoI read it more like: "The way to get this working for the time being is to skip the upgrade for now and use an old banger laptop you have lying around until the ecosystem is ready for the way you work."
- whbrown 6y ago> "Buy the M1 and switch to a fully remote development experience." At least you'd be getting the impressive battery life from the power efficiency courtesy of RISC ... Still rather silly though.
- skohan 6y agoI'm really hesitant to invest in VSC Remote because I feel like it's a slippery slope to a world where we can't compile software on our own computers anymore
- Demiurge 6y agoThe article mentions that Docker for Desktop on OSX just uses VirtualBox, but I thought it was using xhyve for some time? Switching arch should be less painful when depending on the OS facilities.
- zapt02 6y agoDocker Desktop does -not- run VirtualBox on OSX, that was a long time ago. Docker on OSX uses HyperKit: https://docs.docker.com/machine/get-started/#prerequisite-information https://docs.docker.com/machine/get-started/#prerequisite-in...
- Demiurge 6y agoThanks, yes, that's what I thought.
- deleted 6y ago[deleted]
- cpuguy83 6y agoDocker has dockerd running on an M1, but there's some other things surrounding it that improve the experience that need some work. https://twitter.com/justincormack/status/1331965304273047553 https://twitter.com/justincormack/status/1331965304273047553
- thaJeztah 6y agoAnd Dave decided to end the week with a bang; here's Docker Desktop running on an M1 (with lots of Duct tape); https://twitter.com/mugofsoup/status/1332382741892124675?s=20 https://twitter.com/mugofsoup/status/1332382741892124675?s=2...
- diehunde 6y agoCan somebody explain why can't the Docker devs come up with a native Docker version for MacOS?
- brianwawok 6y agoHow much money would this make the company? How much would it cost to implement? What more profitable projects would get scrapped? Pretty much the answer to any "Why can't X do Y for $0" type question.
- pornel 6y agoBecause Docker is basically a user interface for Linux's built-in API that is unique to Linux. All the heavy lifting of process isolation is done by Linux itself, not Docker. Adding the same interface to other operating systems would require extensive changes to their kernel. In the closed-source macOS that is not feasible. Apple doesn't give that level of access to anyone.
- diehunde 6y agoThank you. I thought it might be something like that.
- herpderperator 6y agoThe Apple kernel is open source [0] though, obviously, people won't be able to install a custom kernel even if patches did exist for it. [0] https://github.com/apple/darwin-xnu https://github.com/apple/darwin-xnu
- jamespetercook 6y agoIs this not true for Windows too though?
- musicale 6y agoYeah, "Docker" for macOS runs in a Linux VM anyway, so... run an ARM Linux VM and ARM docker with associated fat (x86+ARM) docker images. I've known about Xhyve and other lesser-known virtualization systems for macOS, and now I know about vftool, so that's a good thing. Interesting how easy it is to make a VMM using Virtualization.framework.
- Wowfunhappy 6y agoThe process in the OP—starting a VM in Virtualbox, and having Docker use the VM—is basically a manual version of what docker-machine does automatically. https://github.com/docker/machine https://github.com/docker/machine Even though it's all a VM under the hood, docker-machine makes it all feel a bit more streamlined/native. Also, the version of Linux it uses—Boot2Docker—will likely start up more quickly, and probably use slightly fewer resources as well. I'm using docker-machine so I can run Docker on OS X 10.9, which predates Docker Desktop (and Hyperkit).
- degraafc 6y agoDocker Machine is unmaintained though, I'm not sure that it would work to launch VMs on M1 hardware.
- Wowfunhappy 6y agoI'd expect it to work via Rosetta. Alternately, it's a Go project—I'm not sure what the status of Go is on Apple Silicon, but once that's figured out it should be a relatively easy recompile.
- dgdosen 6y agoI'm running docker-machine on an M1 mac right now (via rosetta), installed via homebrew.
- seek3r 6y agoI’m fine with my iPhone and iPad, but my MacBook Pro is a PITA. I own a MBP 13” 2018 with 8GB of RAM. For starters: 1. Windows 10 via Bootcamp boot faster than macOS — on an Apple machine. 2. What’s wrong with a tiling manager? Why I need a third-party app to organise windows? 3. I saw in another HN post that an Apple engineer was patting themselves on the back for the memory mama garment. Then, why the hell at login macOS uses more RAM than Windows? 4. I can’t use Docker for Mac. The same dev environment with Docker and WSL2 on Windows 10 via Bootcamp works fine. I mean, it still sucks because of the limited RAM, but it’s fine. On macOS it’s way slower, and the fans go crazy. The hardware — except for the keyboard and the Touch Bar - is fine. The touchpad is great, the screen is fantastic. But Apple needs to work on the operating system; just don’t touch the shortcuts. Those are fine.
- amelius 6y agoHow fast is a fully parallel -j$(nproc) build of (say) gcc on the M1 versus x86?
- alexellisuk 6y agoThis reminds me of the Docker toolbox experience. If you haven't seen it yet, we can now go one step further with the UX with Dave Scott's port of Docker Desktop - https://twitter.com/mugofsoup/status/1332382741892124675?s=19 https://twitter.com/mugofsoup/status/1332382741892124675?s=1...