| ▲ | jjmarr 6 hours ago |
| Every time I try to install Docker there's a warning that being in the "docker" group is equivalent to having root access. You should probably know about this workaround by now. |
|
| ▲ | jonny_eh 5 hours ago | parent | next [-] |
| Most of us install Docker just to run a project locally, and is part of a long checklist of things to install. We can't expect everyone to be an expert on the hundreds of apps/tools/packages that get installed on a machine. It's like expected people to read, and understand, all the terms of service shoved in front of us on a daily basis. |
| |
| ▲ | Ajedi32 4 hours ago | parent | next [-] | | That's why adding your user account to the docker group is a separate step that explicitly does not happen as part of the installation: https://docs.docker.com/engine/install/linux-postinstall/ > Warning > The docker group grants root-level privileges to the user. For details on how this impacts security in your system, see Docker Daemon Attack Surface. | | |
| ▲ | HeWhoLurksLate 2 hours ago | parent | next [-] | | wait so just being lazy and using sudo on Docker commands instead of figuring things out actually means I'm being safer? awesome. | | |
| ▲ | SpaceNoodled an hour ago | parent [-] | | This feels like using Docker is just inherently unsafe. | | |
| ▲ | dymk an hour ago | parent | next [-] | | That’s what rootless docker is for | |
| ▲ | itintheory an hour ago | parent | prev [-] | | This feels like using sudo is just inherently unsafe. | | |
| ▲ | alsetmusic an hour ago | parent [-] | | This feels like using a computer is inherently unsafe. On the plus side, once we outlaw them we'll shut down the ability for conspiratorial thinking to spread easily and the world will slowly heal from the last couple of decades (the previous one in particular). Hooray! We're finally doing something about the harms of social media. Smash your computer today! |
|
|
| |
| ▲ | amelius 3 hours ago | parent | prev [-] | | And containers were supposed to make things safer ... Huge design mistake if you ask me. | | |
| ▲ | twelvedogs an hour ago | parent | next [-] | | i don't see how it's a design mistake, linux allows more footguns in general to not decrease utility. Allowing you to manually give root prompt access (with warnings!) to a non-root user is one of them. you can also just not run docker as root and not add normal users to the docker group | |
| ▲ | halfcat 2 hours ago | parent | prev [-] | | Containers were never a security boundary |
|
| |
| ▲ | ventana 4 hours ago | parent | prev | next [-] | | That's true, the majority of people probably install software without much thinking; but it's also true that it's always better to have at least some high level understanding how the specific piece of software works. What access the given software has, will it send something over the network or work locally; that kind of stuff. As for Docker, I would assume everyone who ever tried to bind-mount a volume for writing from inside the container (on Linux*) then were surprised to see root-owned files in their bind-mounted directory. For me personally, that was the moment I realized that containers, by default, have root access to the filesystem. No written warning serves better than the need to chown some root-owned files. * Not on macOS. On macOS Docker basically runs in a VM, and there's no root access to the host filesystem from what I understand. [edit: formatting] | | |
| ▲ | ethin an hour ago | parent [-] | | I primarily use Incus for all container stuff, not Docker. Is problematic if I want to e.g. use a docker-compose file, but I (think) it protects against these things because incus allows me to create a vm and not a container if I really need that level of isolation. |
| |
| ▲ | aftbit 3 hours ago | parent | prev | next [-] | | Most people buy scissors just to cut some paper. We can't expect everyone to recognize that they are sharp. | | |
| ▲ | vdfs 3 hours ago | parent [-] | | To be fair, I struggled since forever to understand this root group thing and didnt bother to add to docker group. This workaround give me a better understanding, like seeing someone cut themselves on a scissor |
| |
| ▲ | godelski 4 hours ago | parent | prev | next [-] | | > Most of us install Docker just to run a project locally
If you're on linux can I encourage people to move to systemd?I'll admit, systemd is a bit more annoying, but the main annoyance is that there aren't the pre-built images that you can just set and go. That same capability exists with systemd (via `importctl` and `machined`), but those configurations don't already exist. But on the plus side, I've been working with systemd since pre-LLM days and I feel that they are pretty good at dealing with these configurations[0]. Now, with that out of the way... Systemd already is working with your OS. So you get nice things like virtual machines (`systemd-vmspawn`), containers (`systemd-nspawn`), and portables[1] (`systemd-portabled`) (not to mention `homed`!). I've found these to be fairly easy to setup and quite natural if you're already used to the linux ecosystem. I've never been great at docker, but these have felt much more natural to me. So different strokes for different folks. There's definitely a learning curve, but that's also true for docker or any other container system. Importantly, I find security easier to handle with systemd because I can use `systemd-analyze` and the control settings are almost identical across VMs, spawns, and portables. So makes for less learning and greater control. Definitely not for everybody, but I think is also a tool that's underappreciated. [0] And I don't feel this way about bash scripting! The advantage here is that these systemd configuration files are fairly boilerplate. Enough that I stash templates in my dotfiles and copy paste them when I build new services, timers, machines, whatever. So perfect type of LLM task. 90% of the time. But hey, we're also on HN and I'm talking to the nerds. Systemd isn't for everyone [1] https://systemd.io/PORTABLE_SERVICES/ also see https://github.com/systemd/portable-walkthrough Portables are actually often what people want with what they're doing with docker. EDIT: I very frequently will spawn a machine to run a program that's on a different base distro. Not because I can't run/don't know how to run debs or rpms on arch based distros (I do), but because frankly, it is often easier to just spawn a container after I've already made the first image (cloning images is trivial). | | |
| ▲ | worik 4 hours ago | parent [-] | | I too have learnt to like systemd. But what is the relevance here? In what way is it a replacement for docker? | | |
| ▲ | godelski 4 hours ago | parent [-] | | > In what way is it a replacement for docker?
Look at the man pages for `machinectl` (then `systemd-nspawn`, `systemd-vmspawn`, and if you want `systemd-portabled`). This is a replacement for docker.These are container tools offered by systemd. | | |
| ▲ | MrDrMcCoy 3 hours ago | parent | next [-] | | The problem is that the tooling for creating, importing, and managing images is not as good with systemd vs Podman/Docker. There's also no clear path to import images from the Docker ecosystem, at least as far as user experience goes. I know how to do it, but the number of extra steps involved always drives me back to Podman. | | |
| ▲ | godelski 2 hours ago | parent [-] | | I don't really find them that bad but I'm still going to maintain my "different strokes for different folks" position. Might be bad for you and good for others. More options isn't a bad thing |
| |
| ▲ | ciupicri 3 hours ago | parent | prev [-] | | podman is supposedly a replacement for docker. | | |
| ▲ | godelski 2 hours ago | parent [-] | | There's plenty of container technologies and I'd be happy to see more of them used. Podman isn't for me, but it is a great option for others. Regardless, I think it is relatively unknown that systemd can be used for creating containers. |
|
|
|
| |
| ▲ | sieabahlpark 4 hours ago | parent | prev [-] | | [dead] |
|
|
| ▲ | toasty228 4 hours ago | parent | prev | next [-] |
| > My """ai""" just did something amazing, click to learn more 99% of the time it just read the man or some other form of documentation |
| |
|
| ▲ | linsomniac 5 hours ago | parent | prev | next [-] |
| I recently switched over to podman and it's been great! |
| |
| ▲ | anakaine 5 hours ago | parent [-] | | Podman on Windows - never been able to fully get rid of it and it throws errors on boot after uninstall. Was a fan, am now not. | | |
| ▲ | linsomniac 5 hours ago | parent | next [-] | | Good to know, I'm on Linux, switching our dev/stg/prod servers over to it partly because we had all this workaround mechanics in place so that "apt update" updating docker packages wouldn't restart services (we typically don't rotate machines out of the load for just an apt update). Podman + quadlets conversion was not terribly hard, and has eliminated this issue. | |
| ▲ | Zardoz84 5 hours ago | parent | prev [-] | | Don't use Windows | | |
|
|
|
| ▲ | Retr0id 2 hours ago | parent | prev | next [-] |
| There are lots of ways to get root on a typical Linux developer workstation, the point is that agents shouldn't be using any of them unprompted. |
| |
| ▲ | anygivnthursday an hour ago | parent [-] | | This. I am running Claude in its own QEMU VM, it has git access to my project only if I explicitly unlock the ssh key for it. The other day I realized it trying to push a change, it didn't have permission, so it went looking for "workarounds" and found I had a github cli session and tried to use that, luckily the creds for that was also read scoped. But the point is, if I did not give permission and it sees I did not give permission, it should not try to find a workaround/exploit autonomously. |
|
|
| ▲ | 2 hours ago | parent | prev | next [-] |
| [deleted] |
|
| ▲ | Youden 6 hours ago | parent | prev | next [-] |
| I think that's distro-specific. Some set it up with more secure defaults (unix socket with permissions), others less (TCP socket). |
| |
| ▲ | eddythompson80 6 hours ago | parent | next [-] | | I don't really know of any distro that doesn't do that. All of Docker Inc. default installs and all of distros I know of don't automatically add you to the docker group. docker.com instructions has the infamous "linux post-install instructions" that explain and walk you though it. The tragedy is of course that when security and usability collide, 80/20 rule will apply where 80% of people will pick usability over security. I have worked with many with the title >= "Senior Engineers" who saw that page, read the explanation, and still had no idea what the ramifications of their changes were. "Yeah sure it said any user in the docker group will be able to get root on the host, but aren't containers isolated?" | | |
| ▲ | fps-hero 3 hours ago | parent [-] | | That’s the mental model that works for people, specifically those that come from VM workflow. Ironically that’s how Docker works on every platform where it’s running a non-native OS. On macOS that’s how all images are run. Linux on Linux is the only Docker combination that is particularly problematic from a security perspective. Virtualisation has advanced greatly since docker was introduced, if your running in local hardware that’s supports virtualisation, Docker should be running images fully virtualised. There is no good reason to use the OS kernel for most use cases as the performance impact is negligible. If you need kernel access there are better options, like systemd containers. | | |
| ▲ | eddythompson80 an hour ago | parent [-] | | I agree that virtualization has seen great advances. Kata containers on k8s are almost (not quite 100%) drop in replacement. Regardless those last 10% remain a problem. I run a personal server for few open source applications for personal use. I was thinking with all the supply chain attacks, and how carelessly I run `docker pull`s to update things I should probably consider hardening things a bit. I thought before jumping to full virtualization with Kata I can easily try gvisor/runsc first. Only to realize that DNS resolution is completely different with runsc vs runc and had to switch back. Another sticking issue with virtualization is resource allocation. With namespace docker you can easily oversubscribe each container CPU/memory and rely on the single kernel letting individual containers burst as needed. With full virtualization this is still a big problem. Even with balloon devices and dynamic memory and CPU etc, the resource allocation is still not optimal. On a basic 8 core/16GB machine you can run 1 or 2 dozen services and things generally workout fine. Trying to run each of those in a virtualized VM you suddly can maybe run 6 or 7 maybe. There is no way to tell VM 3 kernel to drop its file system cache because VM 6 needs to load a large file in memory. Even if you script it out, now VM 3 is slow because it dropped all its cache while VM 6 finished processing 3 hours ago. These are not unsolvable problems, but despite how far virtualization has come, are still friction points. Not to mention issues like sharing hardware devices (GPUs, disks, USB devices etc) between multiple VMs |
|
| |
| ▲ | cpuguy83 6 hours ago | parent | prev | next [-] | | No, docker access means root.
You can use "rootless" mode, in this case it means root in a user namespace (that is not the "host" user namespace). | |
| ▲ | isityettime 5 hours ago | parent | prev [-] | | That's not relevant. If you have access to the Docker daemon running as root, whether it's over a Unix socket or a TCP socket, you effectively have root. |
|
|
| ▲ | worik 4 hours ago | parent | prev [-] |
| That, in a nutshell, is why I do not install Docker |