Cached directory is not being restored

Hello, I am trying to cache and restore a docker image between builds. The docker directory is always empty when I run a new build and the image is pulled every time. From what I understand after the first run of this code the docker directory should contain the .tar archive. The tar is 12GB but even when I tried a text file it wasn’t restored.

I am basing my code on this

Can someone explain why this isn’t working?

    - docker

    - "~/docker"
    - docker login -e $QUAY_EMAIL -u $QUAY_USER -p $QUAY_PASS
    - if [[ -e ~/docker/image-5fa2c46.tar ]]; then docker load -i ~/docker/image-5fa2c46.tar; else docker pull; fi
    - if [[ ! -e ~/docker/image-5fa2c46.tar ]]; then mkdir -p ~/docker; docker save -o ~/docker/image-5fa2c46.tar; fi


So Docker caching isn’t​ officially supported on CircleCI 1.0. This is due to technical issues with Docker running on our LXC platform. If you check the Docker version, you’ll see that it’s a very outdated version.

I’d suggest switching over to CircleCI 2.0 which officially supports Docker. It’s faster and better suited for the job. We even have a proper mechanism for supporting Docker layer caching though each individual host a build runs on may cache layers in its own for some time.

@rohara Anything I’m missing?

Accurate @FelicianoTech. In 2.0 we keep a virtual machine running so a Docker container can even stay running between builds if desired.

I think the size limit is 3GB

Ok Thanks. The cache wasn’t restored for a text file either when I tested that.

Also, I tried 2.0 and the build would fail with an unknown exception every time.

> Received 'killed' signal

Read this thread but couldn’t get it to work.

It seems like something to do with circle 2.0 because it didn’t happen running with 1.0 or locally.

Is this also related to the size of the image?

If you can tell me how to fix this error I’d happily move to 2.0

version: 2
  - image: 
working_directory: /home/ubuntu/home/
  - checkout
  - setup_remote_docker:
      reusable: true
      exclusive: true
  - run:
      name: Test
      command: bazel --batch build //...

Are you running out of memory? Can you provide a link to where you’re seeing that?

I’ll DM you.