kos
kos

Reputation: 1791

Sharing Docker cache across Docker-in-Docker containers

I would like to share the docker image cache across several Docker-in-Docker containers running on the same host.

I realise that the DIND setup is not ideal, but at the moment I'm trying to minimise changes in a tricky setup.

Is there a way I can expose the host's Docker cache to the DIND containers running on it? Or another way to accomplish this?

Upvotes: 1

Views: 1649

Answers (1)

Leonardo Dagnino
Leonardo Dagnino

Reputation: 3215

I can see this working through mounting /var/lib/docker or (preferably, I think) /var/lib/docker/image in the container, either directly there or changing the daemon's data-root. That would definitely depending on using the same driver both in the container and on the host. It might also eat your babies though.

As a side note, do you really need to actively build images that share things both on the container and the host, though? I feel like in most DIND scenarios, you'd prefer building images mostly inside the container...

Upvotes: 1

Related Questions