Cached directory is not being restored

docker
cache
circle.yml

#1

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 https://circleci.com/docs/1.0/docker/#caching-docker-layers

Can someone explain why this isn’t working?

machine:
  services:
    - docker

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

#2

Hi,

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?


#3

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


#4

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


#5

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
jobs:
  build:
docker:
  - image: quay.io/repo/image:commit-5fa2c46 
working_directory: /home/ubuntu/home/
steps:
  - checkout
  - setup_remote_docker:
      reusable: true
      exclusive: true
  - run:
      name: Test
      command: bazel --batch build //...

#6

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


#7

I’ll DM you.


#8