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
[]block
Custom registries to configure for the cache network
[]block
Networks to attach the cache container to
Field Type Description meta.id
string
Full resource identifier meta.type
string
Resource type (always "image_cache"
) meta.name
string
Resource name
Configure additional registries for the image cache.
Field Type Required Description hostname
string
✓ Hostname of the registry auth
block
Authentication configuration for the registry
Authentication configuration for a registry.
Field Type Required Description hostname
string
Hostname for authentication (can differ from registry hostname) username
string
✓ Username for authentication password
string
✓ Password for authentication
Network attachment configuration for the cache container.
Field Type Required Description id
string
✓ Network resource ID to attach to ip_address
string
Static IP address to assign aliases
[]string
Network 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 " ]