Re:How to use Podman inside of a container
by devjab on Wednesday April 26, 2023 @01:58AM
(#35710045)
Yo dawg, I heard you liked containers so I put a container inside your container!
In all seriousness though, I wonder if this could solve one of our issues of running mutli-container apps in Azure, which is currently causing us some trouble in regards to VNETs and Private Endpoints. I’m sure it’s likely because we should be using Kubernetes or similar, or at the very least have someone who knows how to actually set the Ops part of DevOps up better than we currently do. Long story short, those things won’t realistically happen, and if we could solve them by running multiple podmans inside a docker docker-container deployed as an azure app then we could likely fix our security issues of not being able to setup VNETs and PEs on multi-container apps because it’s been a “up-coming” feature for at least a year.
I’d be interested to know your thoughts on it. The efficiency doesn’t matter as much, our workloads are around 1-5% of our Azure budget which is basically a blip on the bigger budgets.
Re:How to use Podman inside of a container
by mhio on Friday April 28, 2023 @04:05AM
(#35738734)
App Service won't allow the level of privilege needed to start the "head" container that enables container-in-container to work. Options like `--privileged` and `--cap SYS_ADMIN` or mounting special volumes from the host are the first step on "how to escape from a container" so shared container services don't allow them. The options might be more allowable in your own App Service Environment but I don't think the API is even there to set the options in the first place.
Container-in-container also pushes a number of responsibilities from the the App Service down into the head container, like ingress, service management, health, logging etc. You might as well run compose/swarm on your own VM(s) than reinvent those wheels.
AKS + kompose might be a not too bad option. AKS can deploy on the private vnet and can do private endpoints. The cluster will probably fall over once a year for <reasons> but it will mostly manage itself. If you leave k8s to auto upgrade, run a microk8s instance as a test env somewhere and it will hit the upgrade issues before AKS releases a k8s version.
Re:How to use Podman inside of a container
by rexsteroxxy on Wednesday April 26, 2023 @03:30AM
(#35710521)
> Most of this has historically been related to Docker in Docker (DIND), but now, people also want to run Podman in Podman (PINP) or Podman in Docker (PIND).
Re:How to use Podman inside of a container
by RandomBK on Wednesday April 26, 2023 @03:33AM
(#35710543)
This is very useful for running containers in lightweight untrusted environments.
I personally use this setup for my GitLab CI runners, using a mix of podman and buildah to build containers. I can't 100% trust the container build script, so avoiding having to expose a Docker socket to that untrusted code is a critical safety layer.
Re:How to use Podman inside of a container
by Hendrikto on Wednesday April 26, 2023 @04:38AM
(#35710936)
Building containers within a CI system, for example. CI jobs run as images, with a DinD service attached, which they can use to build images themselves.
Re:How to use Podman inside of a container
by sgsag33 on Wednesday April 26, 2023 @04:44AM
(#35710977)
But even if I run in a container e.g. a Github actions runner I can use buildah to build my image right? So no need for another container. Why is there another layer needed?
Re:How to use Podman inside of a container
by hkwerf on Wednesday April 26, 2023 @04:32AM
(#35710896)
I ship containers to customers. Would be nice to run tests against them before releasing a container and it would be nice if those tests themselves could run in a container in order to have a clean test environment.
Re:How to use Podman inside of a container
by sgsag33 on Wednesday April 26, 2023 @04:46AM
(#35710999)
You could create that test environment image beforehand, mirror it and use it for the job that needs it. No need for adding another container within a container.
Re:How to use Podman inside of a container
by Reventlov on Wednesday April 26, 2023 @04:21AM
(#35710832)
Being able to run rootful stuff in rootless containers is nice for CI where you need for example to install a bunch of stuff or mount things. There are stuff that requires being root, and you might not want to give a real root access to your CI.
Re:How to use Podman inside of a container
by Taywee on Wednesday April 26, 2023 @10:40AM
(#35714366)
Yes, there are other ways to do it, but adding another tool as an option is good, too. Being able to nest containers makes composeability a little bit better, too. For instance, if I want an image that effectively has multiple base images, instead, I can just run both base images in containers inside of the parent container. You can bundle a lot of related containers into an arbitrary app container. It's a natural expression of programming composition into a containerization context, in my opinion.
Containers being nestable components makes a lot of natural wants much more natural to express.
Re:How to use Podman inside of a container
by movedx on Wednesday April 26, 2023 @04:20AM
(#35710820)
Over complicating the engineering (Docker) involved in getting some x86 code into RAM and on a CPU stack, by over complicating further (DIND.) It's essentially another way to abstract and abstraction, and engineers are finding ways to justify it.
Re:How to use Podman inside of a container
by spyremeown on Wednesday April 26, 2023 @07:40AM
(#35712111)
It's not really over complicating anything, though? It makes perfect sense, it's not hard to understand. Nested VMs have been a thing for a looong time.
I honestly don't understand where the criticism for Docker and k8s comes from. Some of HN comments sound like old men shouting at the clouds because they don't understand modern technology and its purposes.
If you want, go right ahead with your managed, on-site VMs where you copy a .php file to an Apache server using a thumb drive and restart the service. I don't care. But that's not how modern teams are working.
Re:How to use Podman inside of a container
by movedx on Wednesday April 26, 2023 @08:43AM
(#35712765)
> But that's not how modern teams are working.
I'd suggest you do more research. Plenty of teams in (very) big companies, handling (very) large workloads not doing what you'd want them to.
Docker? Docker is ideal for teams deploying quickly evolving (possible stateless) applications across multiple platforms. If you have no need to deploy across multiple platforms, simply deploy directly to your OS using the best primitives possible.
Kubernetes? Excellent for when you need to do multiple, rapid deployments per day of small (ideally stateless) services. A good example of this is small services that serve up adverts in response to some "profile" of a visitor sent to it from a browser - these things evolve a lot, and often.
Abstracting your abstractions because you don't want to learn how-to make the OS better or use what's already there isn't clever. Learning to use the tools is the important thing, and Docker and K8s are just tools.
Re:How to use Podman inside of a container
by orthoxerox on Wednesday April 26, 2023 @04:57AM
(#35711072)
For example, your CI/CD agent is running in a container, and has to build and test containerized software. You can use something like buildah to build your app containers without a container runtime, but you want to run them to run the tests.
Ideally, you would want to do this while remaining platform-agnostic, so your agents will be able to start a container no matter where they are themselves: on bare metal, in Podman, in Docker, in k8s.
Re:How to use Podman inside of a container
by 100011_100001 on Wednesday April 26, 2023 @09:55AM
(#35713692)
I was about to say the same thing. We currently use a podman container, deploy it in Kubernetes, build container images with it for CI, push them and scale down the podman container.
Re:How to use Podman inside of a container
by qudat on Wednesday April 26, 2023 @07:56AM
(#35712267)
Ive been reading every line of this blog for a week trying to get it to work — and failed.
The goal is container driven development. But if all my dev tools are inside a container, how do I iterate on building new containers within a container? This is the core feature I wanted.
But unfortunately, this challenge proved way too difficult to pull off and nothing seemed to work for me.
My guess is these setups heavily depend on the host machine and how podman was setup on it which breaks the entire value of using container driven dev.
Re:How to use Podman inside of a container
by twic on Wednesday April 26, 2023 @10:23AM
(#35714108)
Here's another one. I have an app which spawns subprocesses to do computations. I would love to put the subprocesses in containers to constrain their resource usage (i know that's not the only way to do it, but it's an effective and well-understood way to do it). But i would also like to able to run my application in a container!
Re:How to use Podman inside of a container
by electroly on Wednesday April 26, 2023 @10:46AM
(#35714475)
While using containers is common and well-understood, containers within containers are not. It's novel enough to warrant this blog post on how to do it!
If all you want is resource constraints on your spawned processes, it's easier and more common to just use cgroups. It's straightforward and you should have a working understanding of cgroups anyway if you want to be effective at using containers, which are built on top of cgroups.
Cgroups are really easy to use and I feel like people aren't bothering to learn about it. :(
Re:How to use Podman inside of a container
by yrro on Wednesday April 26, 2023 @11:59AM
(#35715849)
To be fair cgroupsv1 and the original tooling around them weren't so great. And people were stuck with them for aaaaaages because the cpu controller wasn't ported to v2 for so long. And then they were still stuck on v1 because of Docker...
Re:How to use Podman inside of a container
by zzbn00 on Wednesday April 26, 2023 @11:32AM
(#35715364)
I use MicroOS (https://microos.opensuse.org/), to keep the base operating system clean you'd install helper tools for constructing containers in a container... so two levels of containers would be very helpful
Re:How to use Podman inside of a container
by Izkata on Wednesday April 26, 2023 @01:45PM
(#35717467)
Ever since we started moving to Docker it's been a massive pain. I'm on a maintenance team doing both legacy (non-Docker) and the occasional Docker-based system that gets handed to us (and then a few months later taken back, it's kind of annoying), and not a single member of my team has gotten the Docker-based systems to work. We all end up with different issues getting Docker to run, or for the different containers to communicate, or being able to browse to the app running in the container. Different systems from different teams also have a tendency to interfere with each other. Two years after this started I finally got an admission from the main development team that every new dev on their team has had similar problems.
On the flipside, LXD containers have "just worked" for everyone who has tried it so far. We've been able to use them on a whim for testing stuff, no problems at all.
So I've been wondering for a while if we could use LXD containers to provide a clean slate to run the Docker containers inside of, maybe then we'd at least all have the same problems, if not be able to solve them entirely.
Re:How to use Podman inside of a container
by spyremeown on Wednesday April 26, 2023 @07:37AM
(#35712085)
Kind is super cool! I used it for my thesis, as I needed many nodes without getting super into k8s configuration. I love, love kind. If you're into learning Kubernetes, it's probably the easiest way to get yourself a cluster quickly.
Re:How to use Podman inside of a container
by codethief on Wednesday April 26, 2023 @07:54AM
(#35712252)
I realize that Linux wasn't made for containerization originally and that's why it's so so painful to nest containers, run them without root etc. But I wish we'd already live in a world where all binaries (maybe with the exception of command line tools) ran containerized by default and I, as the user, had to grant explicit access to files, network, hardware/devices, etc. Not just for security reasons (though it'd be nice if `npm install` and `pip install` couldn't mess up my entire system) but also to make external dependencies more explicit.
Re:How to use Podman inside of a container
by dilyevsky on Wednesday April 26, 2023 @12:52PM
(#35716682)
It's not so painful and most pain comes from Linux insistence on /proc-based APIs as opposed to something similar to Solaris-descendants where it's a json spec (I think xml originally)
Re:How to use Podman inside of a container
by PhilippGille on Wednesday April 26, 2023 @01:01PM
(#35716847)
Isn't that what Snap and Flatpak are doing? 1) Include dependencies (there can be shared runtimes but they don't mess up the host), 2) sandboxed by default and you need to grant permissions.
Re:How to use Podman inside of a container
by kytazo on Wednesday April 26, 2023 @02:00PM
(#35717657)
Sounds like android or what a modern linux distro should look like.
Sadly both most used userspace distros and the kernel they come with are borderline dangerous and shouldn't be any trusted by people using them, even if they're technical enough to feel comfortable within their environment.
Re:How to use Podman inside of a container
by musicale on Wednesday April 26, 2023 @04:04PM
(#35719232)
It's a shame that multi-ring security never really made a comeback.
The ability to let any ring (such as a user ring) handle the library and system calls of an outer ring (such as a container ring) seems like it would be convenient.
Alternately, some microkernels have a more peer-to-peer setup which could work as well.
Re:How to use Podman inside of a container
by ashishbijlani on Thursday April 27, 2023 @01:01PM
(#35731150)
I built Packj [1] sandboxing for securing “pip/NPM install”. It uses strace for sandboxing and blocks access to sensitive files and limits traffic to known-good IP addresses.
Re:How to use Podman inside of a container
by eriksjolund on Wednesday April 26, 2023 @03:37PM
(#35718850)
I just tried this out.
The new systemd directive OpenFile=
opens up the possibility to pass the file descriptor
of a file from the host to a container running in a container.
(using rootless Podman running rootless Podman)
sudo systemd-run --property User=test --property OpenFile=/etc/secretfile.txt --collect --pipe --wait --quiet podman run --security-opt label=disable --user podman --device /dev/fuse quay.io/podman/stable podman run -q alpine sh -c "cat <&3"
In all seriousness though, I wonder if this could solve one of our issues of running mutli-container apps in Azure, which is currently causing us some trouble in regards to VNETs and Private Endpoints. I’m sure it’s likely because we should be using Kubernetes or similar, or at the very least have someone who knows how to actually set the Ops part of DevOps up better than we currently do. Long story short, those things won’t realistically happen, and if we could solve them by running multiple podmans inside a docker docker-container deployed as an azure app then we could likely fix our security issues of not being able to setup VNETs and PEs on multi-container apps because it’s been a “up-coming” feature for at least a year.
I’d be interested to know your thoughts on it. The efficiency doesn’t matter as much, our workloads are around 1-5% of our Azure budget which is basically a blip on the bigger budgets.
I’m fact currently using Consul for one such problem as it happens: managing Docker from inside Docker.
Container-in-container also pushes a number of responsibilities from the the App Service down into the head container, like ingress, service management, health, logging etc. You might as well run compose/swarm on your own VM(s) than reinvent those wheels.
AKS + kompose might be a not too bad option. AKS can deploy on the private vnet and can do private endpoints. The cluster will probably fall over once a year for <reasons> but it will mostly manage itself. If you leave k8s to auto upgrade, run a microk8s instance as a test env somewhere and it will hit the upgrade issues before AKS releases a k8s version.
- https://github.com/kubernetes/kompose
- https://learn.microsoft.com/en-us/azure/aks/private-clusters...
So close to some acronym puns :D
I personally use this setup for my GitLab CI runners, using a mix of podman and buildah to build containers. I can't 100% trust the container build script, so avoiding having to expose a Docker socket to that untrusted code is a critical safety layer.
Either way, it will be done. Ask IBM. What's the use case for running OS360 VMs inside OS360 VMs?
We repeat the same patterns IBM discovered in the 1960s, but with more building materials.
Power consumption and size/weight are better though. ;-)
Containers being nestable components makes a lot of natural wants much more natural to express.
If you want, go right ahead with your managed, on-site VMs where you copy a .php file to an Apache server using a thumb drive and restart the service. I don't care. But that's not how modern teams are working.
I'd suggest you do more research. Plenty of teams in (very) big companies, handling (very) large workloads not doing what you'd want them to.
Docker? Docker is ideal for teams deploying quickly evolving (possible stateless) applications across multiple platforms. If you have no need to deploy across multiple platforms, simply deploy directly to your OS using the best primitives possible.
Kubernetes? Excellent for when you need to do multiple, rapid deployments per day of small (ideally stateless) services. A good example of this is small services that serve up adverts in response to some "profile" of a visitor sent to it from a browser - these things evolve a lot, and often.
Abstracting your abstractions because you don't want to learn how-to make the OS better or use what's already there isn't clever. Learning to use the tools is the important thing, and Docker and K8s are just tools.
Ideally, you would want to do this while remaining platform-agnostic, so your agents will be able to start a container no matter where they are themselves: on bare metal, in Podman, in Docker, in k8s.
The goal is container driven development. But if all my dev tools are inside a container, how do I iterate on building new containers within a container? This is the core feature I wanted.
But unfortunately, this challenge proved way too difficult to pull off and nothing seemed to work for me.
My guess is these setups heavily depend on the host machine and how podman was setup on it which breaks the entire value of using container driven dev.
https://bower.sh/opensuse-microos-container-dev
If all you want is resource constraints on your spawned processes, it's easier and more common to just use cgroups. It's straightforward and you should have a working understanding of cgroups anyway if you want to be effective at using containers, which are built on top of cgroups.
Cgroups are really easy to use and I feel like people aren't bothering to learn about it. :(
On the flipside, LXD containers have "just worked" for everyone who has tried it so far. We've been able to use them on a whim for testing stuff, no problems at all.
So I've been wondering for a while if we could use LXD containers to provide a clean slate to run the Docker containers inside of, maybe then we'd at least all have the same problems, if not be able to solve them entirely.
https://ubuntu.com/tutorials/how-to-run-docker-inside-lxd-co...
If you use podman you can just use the default storage backend (zfs).
[1] https://kind.sigs.k8s.io/
E.g. Snap sandboxing: https://snapcraft.io/docs/security-sandboxing
It doesn't help a lot that instead of having a explicit "can I have a host file" API, the apps are supposed to use a framework that invokes "portals".
Sadly both most used userspace distros and the kernel they come with are borderline dangerous and shouldn't be any trusted by people using them, even if they're technical enough to feel comfortable within their environment.
The ability to let any ring (such as a user ring) handle the library and system calls of an outer ring (such as a container ring) seems like it would be convenient.
Alternately, some microkernels have a more peer-to-peer setup which could work as well.
1. https://github.com/ossillate-inc/packj
sudo systemd-run --property User=test --property OpenFile=/etc/secretfile.txt --collect --pipe --wait --quiet podman run --security-opt label=disable --user podman --device /dev/fuse quay.io/podman/stable podman run -q alpine sh -c "cat <&3"