cog icon indicating copy to clipboard operation
cog copied to clipboard

Cog cached

Open darkeagle1236 opened this issue 3 years ago • 5 comments

 => CACHED [stage-0  2/10] RUN --mount=type=cache,target=/var/cache/apt apt-get update -qq && apt-get install -qqy --no-install-recommends  make  build-essential  libssl-dev  zlib1g-dev  libbz2-dev  libreadline-dev  libsqlite3-dev  wget  curl  llvm  libncurses5-de  0.0s
 => CACHED [stage-0  3/10] RUN curl https://pyenv.run | bash &&  git clone https://github.com/momo-lab/pyenv-install-latest.git "$(pyenv root)"/plugins/pyenv-install-latest &&  pyenv install-latest "3.8" &&  pyenv global $(pyenv install-latest --print "3.8")        0.0s
 => CACHED [stage-0  4/10] COPY .cog/tmp/build1590162682/cog-0.0.1.dev-py3-none-any.whl /tmp/cog-0.0.1.dev-py3-none-any.whl                                                                                                                                               0.0s
 => CACHED [stage-0  5/10] RUN --mount=type=cache,target=/root/.cache/pip pip install /tmp/cog-0.0.1.dev-py3-none-any.whl                                                                                                                                                 0.0s
 => CACHED [stage-0  6/10] RUN --mount=type=cache,target=/var/cache/apt apt-get update -qq && apt-get install -qqy libgl1-mesa-glx libglib2.0-0 && rm -rf /var/lib/apt/lists/*                                                                                            0.0s
 => CACHED [stage-0  7/10] RUN --mount=type=cache,target=/root/.cache/pip pip install -f https://download.pytorch.org/whl/torch_stable.html   cmake==3.21.2 torchvision==0.9.0+cu111 torch==1.8.0+cu111 numpy==1.19.4 opencv-python==4.4.0.46 scipy==1.5.3 tensorboardX=  0.0s
 => CACHED [stage-0  8/10] RUN pip install dlib                                                                                                                                                                                                                           0.0s
 => CACHED [stage-0  9/10] WORKDIR /src                                                                                                                                                                                                                                   0.0s
 => [stage-0 10/10] COPY . /src                                                                                                                                                                                                                                           0.4s
 => exporting to image                                                                                                                                                                                                                                                    0.2s
 => => exporting layers                                                                                                                                                                                                                                                   0.0s
 => => writing image sha256:50b6ce778efb24761ab4bb9a7a4f491274898ee906efdb97691d2625cecefdb9                                                                                                                                                                              0.0s
 => => naming to docker.io/library/testcog11                                                                                                                                                                                                                              0.0s
 => exporting cache

I see some stages have "CACHED" in the beginning. I'm wondering how can i get rid of those caches and have a fresh build. It seems like the first build was an error, the docker container couldn't clone any repository. Therefore every build since was so fast. I removed Cog as mentioned in README but it seems like just the execution files.

darkeagle1236 avatar Mar 14 '22 09:03 darkeagle1236

cog build invokes docker build with a generated Dockerfile. To delete all of your local docker images you can use this command:

docker rmi $(docker images -a -q)

If you've got local docker images you'd like to preserve, you can pass a list of the broken image IDs to docker rmi.

If you try that, does rebuilding work?

evilstreak avatar Mar 29 '22 12:03 evilstreak

I'm also having this problem but deleting all my docker images didn't fix it for me.

I found a workaround for now where I remove the cached line from the cog file, rebuild, then put it back in, and rebuild it again, and it builds fresh.

genekogan avatar Sep 13 '22 15:09 genekogan

Another workaround is docker builder prune after deleting the image. A flag for cog build would be ideal though, deleting images manually takes time and removing the whole build cache might waste time for other builds.

onorabil avatar Jan 11 '23 10:01 onorabil