The image_cache resource creates a container registry cache for Docker images. It allows you to configure custom registries and network connections for caching Docker images locally.
resource "image_cache" "main" {
id = resource . network . main . meta . id
resource "image_cache" "main" {
hostname = " private.registry.com "
id = resource . network . main . meta . id
ip_address = " 10.0.1.100 "
aliases = [ " cache.local " ]
Field Type Required Description registry[]blockCustom registries to configure for the cache network[]blockNetworks to attach the cache container to
Field Type Description meta.idstringFull resource identifier meta.typestringResource type (always "image_cache") meta.namestringResource name
Configure additional registries for the image cache.
Field Type Required Description hostnamestring✓ Hostname of the registry authblockAuthentication configuration for the registry
Authentication configuration for a registry.
Field Type Required Description hostnamestringHostname for authentication (can differ from registry hostname) usernamestring✓ Username for authentication passwordstring✓ Password for authentication
Network attachment configuration for the cache container.
Field Type Required Description idstring✓ Network resource ID to attach to ip_address stringStatic IP address to assign aliases[]stringNetwork aliases for the container
resource "image_cache" "main" {
id = resource . network . lab . meta . id
resource "image_cache" "private" {
hostname = " my-registry.company.com "
username = " service-account "
password = var . registry_password
id = resource . network . main . meta . id
ip_address = " 192.168.1.50 "
aliases = [ " registry-cache.local " ]