-
Notifications
You must be signed in to change notification settings - Fork 111
Support for caching Docker build data on VM host #131
Comments
I'm not sure how well Docker's stuff will behave on VBox shared folder. Do you mind giving the generic bucket a spin before we try implementing something on vagran-cachier's core? thanks in advance! |
I naively tested to set the
EDIT: Just found this page (http://fgrehm.viewdocs.io/vagrant-cachier/development) and got a clue now :D |
Okay, that's the current status:
So docker is not starting correctly anymore :/ Any thoughts? Permission problem? |
Okay, here's my bashy solution. Basically this approach uses
It's possible to save images on
Here's the script to save docker images:
And here's the script for loading docker images:
This solution is a bit slow since we can't hook into the docker build process and have to save the images with an extra write operation per image ( |
I guess that this is too much for us to handle from this plugin. I wonder if it would make sense to have that as a separate plugin that builds on top of cachier and trigger plugins... Going to think a bit more on it. Thanks for all the info so far! |
I'm not quite sure how we'd tie it in to cachier but the registry image can actually be used as a caching-mirror: https://github.com/docker/docker/blob/master/docs/sources/articles/registry_mirror.md:
So maybe the plugin should just configure this registry image to save the images to a cached disk, and then optionally try to configure the docker daemon in the VM? Thoughts? |
It actually already exports every image (downloaded and locally created) on the machine to a cached disk. |
I'm in a similar situation; we're looking to use Vagrant and Docker to create a local development solution. We need to cache Docker images to reduce the time it takes to run 👍 for Docker support in Cachier. |
Another 👍 for docker support in vagrant-cachier |
+1 |
Hey, based on @Yserz I created a Vagrantfile to cache docker images... now I can use Fig and Docker for having a full development enviroment. Even on Windows
My workflow basically involves setting up containers (db, mq, whatever...) and then develop on host machine... please tell me your workflows PS: Java programmer |
@martinsthiago your save and load works good, I'm using it, but it error'd on images with the name IMAGES=`docker images | awk '{print $1}' | grep -v '<none>' | tail -n +2`
docker save -o /docker-cache/images.tar $(echo ${IMAGES[@]}) |
Nice @leighmcculloch, I actually dropped its usage for now :(... I tried to work with some usual containers like postgres and mongo... but there's too much data to be downloaded :( Something around 3GB... waiting for the day we could use a git aproach like PS: I changed fig commands to: Sooo, by adding @leighmcculloch's fix we got -->
|
Maybe an option for docker is just use another container with apt-cacher like this https://registry.hub.docker.com/u/sameersbn/apt-cacher-ng/ |
cc: @mrjcleaver |
A nice solution @fabiand came up with in our use case, is to use an extra disk as docker storage location. # if there is a second disk, use it for docker
if ls /dev/vdb ; then
# We use the loopback docker dm support, and not a VG for now
mkdir -p /var/lib/docker/
restorecon -r /var/lib/docker
mount LABEL=dockerdata /var/lib/docker/ || {
mkfs.xfs -L dockerdata -f /dev/vdb
}
mkdir -p /etc/systemd/system/docker.service.d/
cat > /etc/systemd/system/docker.service.d/mount.conf <<EOT
[Service]
ExecStartPre=/usr/bin/sleep 5
ExecStartPre=-/usr/bin/mount LABEL=dockerdata /var/lib/docker
MountFlags=shared
EOT
mount LABEL=dockerdata /var/lib/docker/
fi Then I just had to add an additional disk to the Vagrant VM which would survive # for vagrant-libvirt provider
if $cache_docker then
domain.storage :file, :size => '10G', :path => 'master_docker.img', :allow_existing => true, :device => vdb
end |
Hey, sorry for the silence here but this project is looking for maintainers 😅 As per #193, I've added the |
I'm building my Docker containers on my VM host and observed that the docker build data is not cached by the vagrant-cachier plugin. I would really like to see such a feature in the future if this is possible somehow :)
Here's my shortened
Vagrantfile
of my virtual host machine:And the
Vagrantfile
of a Docker container:Just to may clearify things an example Output:
The text was updated successfully, but these errors were encountered: