We are building docker image on VSTS by using VSTS Hosted Linux Preview agent. microsoft/aspnetcore-build image is used to build asp.net core application. Each time build is triggered, an agent is pulling microsoft/aspnetcore-build image from registry and it takes some time. We would like to avoid this, by specifying specific image pre-cached on agents.
Is there a list of container images that have been cached on Hosted Linux Preview agent? Such information is available for Hosted VS2017 agent, but not for Linux one.
If you use the default storage driver overlay2, then your Docker images are stored in /var/lib/docker/overlay2 . There, you can find different files that represent read-only layers of a Docker image and a layer on top of it that contains your changes.
The concept of Docker images comes with immutable layers. Every command you execute results in a new layer that contains the changes compared to the previous layer. All previously built layers are cached and can be reused.
Disabling caching You can do so by passing two arguments to docker build : --pull : This pulls the latest version of the base Docker image, instead of using the locally cached one. --no-cache : This ensures all additional layers in the Dockerfile get rebuilt from scratch, instead of relying on the layer cache.
No official article mentions it, I submit a user voice here: Docker image cache on Hosted linux agent that you can vote and follow.
According to this documentation the complete list can be found in the following documents:
(*) The above are permalinks to a specific snapshot of code (dated 2022-03-26). For the most current data, switch to the "main" branch in GitHub. Note that files may disappear from the 'main' branch when image gets deprecated.
As of 2022-03-26, both images include the same set of pre-cached docker images which are:
alpine:3.12
alpine:3.13
alpine:3.14
buildpack-deps:bullseye
buildpack-deps:buster
buildpack-deps:stretch
debian:10
debian:11
debian:9
moby/buildkit:latest
node:12
node:12-alpine
node:14
node:14-alpine
node:16
node:16-alpine
ubuntu:16.04
ubuntu:18.04
ubuntu:20.04
This can also be confirmed by adding a simple task to the pipeline that runs docker image list
. Here's an example of the command's output ran on Ubuntu-16.04
agent (before it was deprecated):
/usr/bin/docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
node 10-alpine 955e0e1f1a41 11 days ago 80.5MB
node 10 bb78c02ca3bf 11 days ago 908MB
node 12-alpine afd897e3184b 11 days ago 85.2MB
node 12 b6f455933a97 11 days ago 913MB
buildpack-deps stretch c82dad0a8baf 2 weeks ago 835MB
debian 9 92416e205014 2 weeks ago 101MB
debian 8 955c8f8160c2 2 weeks ago 129MB
alpine 3.8 c8bccc0af957 3 weeks ago 4.41MB
alpine 3.9 82f67be598eb 3 weeks ago 5.53MB
alpine 3.10 af341ccd2df8 3 weeks ago 5.56MB
jekyll/builder latest 4605d94a6b36 4 months ago 564MB
alpine 3.7 6d1ef012b567 11 months ago 4.21MB
mcr.microsoft.com/azure-pipelines/node8-typescript latest 9a948d360778 16 months ago 595MB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With