News for hackers. Stuff that matters.
Re:Transitioning from Docker to Podman by quietbritishjim on Friday November 20, 2020 @06:31PM (#25166426)
> Docker-in-Docker paradigm

Apologies for the patronising comment, but do you really mean that? Docker in Docker works but is intended for the developers of Docker to debug Docker itself. Usually for running Docker from within a container, you just hook up the Docker client to the TCP port of the Docker daemon running outside the container, which isn't strictly Docker-in-Docker.

I ask this in case you're trying a wildly use case (if you really are running true Docker-in-Docker), or are making an unfair comparison (if you're just using the usual Docker client in container to daemon on host). In the latter case, I must admit I don't know what the idiomatic alternative would be for podman, given that I know nothing about it except that it's daemonless (and even that I only learned by reading your comment).

Re:Transitioning from Docker to Podman by Too on Saturday November 21, 2020 @03:30AM (#25168501)
I think what most people mean when they say docker-in-docker is in layman terms. You simply just a way to do "docker run" from within another container. Whether that's done by actually running docking daemon inside or mounting something from the host or whatever else i don't really care. I just want it to work.

Sure, there are some details you might want to control, like image caches and such being shared with host, i just find there is a lack of documentation and best practices of how to do nested docker, if that is even intended to work or if mounting docker.sock is an unsupported hack. Most information found about this is scattered on shady blogs.

For the examples of CI brought up the use cases are fairly obvious, you have a jenkins installation with x plugins installed - running as a container. Within this jenkins you are building multiple different projects which all require their own respective image to build. As a project developer here i don't even want to know if this jenkins is a bare metal, a vm or a container. Here docker is more used to bundle all the dependencies, not for strict security with perfect containerization.

Re:Transitioning from Docker to Podman by nhoughto on Friday November 20, 2020 @06:57PM (#25166607)
Docker in docker is a very common pattern in CI, in some cases is the only way to achieve certain tasks.
Re:Transitioning from Docker to Podman by bogomipz on Friday November 20, 2020 @08:20PM (#25167090)
There is also Kaniko which works quite well:

https://github.com/GoogleContainerTools/kaniko

Re:Transitioning from Docker to Podman by haberman on Friday November 20, 2020 @07:32PM (#25166811)
What kinds of tasks require two levels of containers?
Re:Transitioning from Docker to Podman by bogomipz on Friday November 20, 2020 @08:21PM (#25167098)
Your CI server running in a container that is itself executing Docker commands.
Re:Transitioning from Docker to Podman by joana035 on Friday November 20, 2020 @08:52PM (#25167277)
That is the main reason why podman exist, so then one can accomplish that task without an extra daemon, dind, nor using the host's dockerd daemon.

This way you don't need to grant "docker" group to the "ci" user and you avoid having your cluster compromised one commit away :)

Re:Transitioning from Docker to Podman by defen on Friday November 20, 2020 @08:52PM (#25167272)
You need more constraints than that to explain why you can't just mount /run/docker.sock in the CI container.
Re:Transitioning from Docker to Podman by ryan29 on Saturday November 21, 2020 @01:02AM (#25168105)
If you mount docker.sock you're building on the runner's daemon so you have to worry about builds interfering with each other. If you use docker-in-docker you get a clean environment every time.
Re:Transitioning from Docker to Podman by bogomipz on Friday November 20, 2020 @10:18PM (#25167637)
If you don't manage your own CI server then that is not an option is it?

I also never said that it requires two levels of Docker or that it requires DinD. I was responding to the general question of the parent who was asking a question of someone who was running DinD. I responded to the GP below that Kaniko also solves this problem so clearly I'm not advocating for running DinD or that this is even needed.

Re:Transitioning from Docker to Podman by wwright on Friday November 20, 2020 @08:50PM (#25167260)
As mentioned elsewhere in the thread, this does not require DinD. You can connect to the host’s Docker daemon. (Other interfaces such as K8S are also much safer.)
Re:Transitioning from Docker to Podman by hinkley on Friday November 20, 2020 @11:19PM (#25167848)
Isn't exposing the host Docker daemon the security issue that people grouse about?
Re:Transitioning from Docker to Podman by bogomipz on Saturday November 21, 2020 @07:03AM (#25169237)
Yes it is. The Docker socket - /var/run/docker.sock is owned by root and so anyone that has access to it effectively has root on that host. User namespace mitigate this to some degree.
Re:Transitioning from Docker to Podman by bogomipz on Saturday November 21, 2020 @06:54AM (#25169192)
Yes and I am one of those people who mentioned elsewhere that this does not require DinD. Please reread the question I am actually responding to which is a general questions "What kinds of tasks ...?" The parent is asking what 'problem is the DinD solution is solving for. You also can not connect to the host's Docker socket if you do not manage that host where Docker is running in the first place.
Re:Transitioning from Docker to Podman by nhoughto on Saturday November 21, 2020 @03:57AM (#25168582)
“kind” is a example in my day to day, how do I run an ephemeral kube cluster in ci to deploy and test my app against without dind/kind? I want N clusters running on 1 host to support many CI jobs.

https://github.com/kubernetes-sigs/kind https://github.com/bsycorp/kind

Re:Transitioning from Docker to Podman by Nullabillity on Saturday November 21, 2020 @02:06PM (#25171910)
FWIW, Kind actually uses CRI-O (same underlying backend as Podman) for the inner containers.
Re:Transitioning from Docker to Podman by iwwr on Saturday November 21, 2020 @03:50AM (#25168553)
Ansible Molecule tests depend strictly on Docker: https://molecule.readthedocs.io/en/latest/

Also if your application is shipped as orchestrated containers (like docker-compose), or as multiple containers in a 'pod' (e.g. sidecars), you may want the ability to run containers from containers as part of CI.

Re:Transitioning from Docker to Podman by jlgaddis on Saturday November 21, 2020 @01:37PM (#25171679)
As of Molecule 3.0, at least -- they didn't in the past.

A while ago, I, unfortunately, decided to add "proper tests" to all of my Ansible roles and decided to use Molecule (2.22, at the time, IIRC). As I don't use Docker, I was using "lightweight VMs" I had created (w/ Packer, converted into Vagrant boxes) with VirtualBox for all of this testing.

I spent I don't know how many hours across several days learning the "toolchain", getting everything setup and working properly, adding full test coverage, and so on. Not long afterwards, they released Molecule 3.0 which required using Docker. :/

Re:Transitioning from Docker to Podman by bmurphy1976 on Friday November 20, 2020 @07:02PM (#25166637)
We use docker-in-docker as well to deploy our Jenkins workers. It has it's pros (running Ubuntu 18.04 and Ubuntu 20.04 workers side-by-side and ease of pushing out an update) but it's fragile and confusing. Things can get really hacky when you need to start sharing volumes or injecting additional configuration.

I'm much more confident with packer now though. Next time I do any major work on our Jenkins infrastructure I'm ripping out docker-in-docker for the workers and replacing it with packer built images.

Re:Transitioning from Docker to Podman by flerchin on Friday November 20, 2020 @06:46PM (#25166534)
We docker-in-docker too, exactly as OP describes. In jenkins CI/CD.
Re:Transitioning from Docker to Podman by outworlder on Friday November 20, 2020 @07:37PM (#25166837)
> but is intended for the developers of Docker to debug Docker itself

Heh. We use DIND with docker compose to have a container which has KUBERNETES inside. And it even works.

How's that for a wild use-case?

EDIT: That's done to create a local dev environment, with K8s, localstack, infra, etc. Instead of having multiple machines or deploying everything outside containers.

Re:Transitioning from Docker to Podman by solotronics on Friday November 20, 2020 @06:45PM (#25166532)
I also needed to run docker commands from within a container (Jenkins container executing docker cmds on the host it's running on). I don't know how common this is but I had the same use case.
Re:Transitioning from Docker to Podman by WatchDog on Friday November 20, 2020 @08:17PM (#25167083)
I do a lot of build automation work, and running containers within containers would be super useful for me.

That said docker-in-docker doesn't work without running privileged or forwarding the host port.

It's a non-starter for me, there are the obvious security problems, but also practical non-security issues. Forwarding the port causes encapsulation issues, a build job can finish leaving stuff running, can also interfere with other jobs on the system.

Using privileged containers isn't an option when using things like ECS fargate.

Re:Transitioning from Docker to Podman by felipelemos on Friday November 20, 2020 @06:44PM (#25166521)
There are some reasons to use docker in docker beyond debug docker itself. For example, in Jenkins case, select specific proxy settings for the daemon for a specific job without affecting other jobs in the same node.