Image Cache
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.
Basic Syntax
Section titled “Basic Syntax”resource "image_cache" "main" { network { target = resource.network.main }}Full Syntax
Section titled “Full Syntax”resource "image_cache" "mirror" { registry { hostname = "private.registry.com"
auth { username = "myuser" password = "mypassword" } }
network { target = resource.network.main ip_address = "10.0.1.100" aliases = ["cache.local"] }}Fields
| Field | Type | Required | Description |
|---|---|---|---|
registry | block | — | Additional registries to cache images fromrepeatable |
network | block | — | Connect this resource to a specific network so it can communicate with other containers or servicesrepeatable |
Registry
Additional registries to cache images from
| Field | Type | Required | Description |
|---|---|---|---|
hostname | string | ✓ | Hostname of the container registry |
auth | block | — | Authentication credentials for the registry |
Auth
Authentication credentials for the registry
| Field | Type | Required | Description |
|---|---|---|---|
hostname | string | — | Hostname for authentication |
username | string | ✓ | Username for authentication |
password | string | ✓ | Password for authentication |
Network
Network attachments for the image cache
| Field | Type | Required | Description |
|---|---|---|---|
id | string | — | ID of the network to attach the container |
target | referencenetwork | — | The network to attach the container to |
ip_ | string | — | Static IP address to assign container for the network, the ip address must be within range defined by the network subnet. If this parameter is omitted an IP address will be automatically assigned. ConstraintsMust be a valid IPv4 address (e.g., 192.168.1.10) |
aliases | list(string) | — | Aliases allow alternate names to specified for the container |
Computed Attributes
These attributes are set by the system and are read-only.
| Attribute | Type | Description |
|---|---|---|
network[].name | string | Name will equal the name of the network as created by jumppad |
network[].assigned_address | string | AssignedAddress will equal if IPAddress is set, else it will be the value automatically assigned from the network |
Examples
Section titled “Examples”Simple Cache with Network
Section titled “Simple Cache with Network”resource "image_cache" "main" { network { target = resource.network.main }}Cache with Private Registry
Section titled “Cache with Private Registry”resource "image_cache" "private" { registry { hostname = "my-registry.company.com"
auth { username = "service-account" password = variable.registry_password } }
network { target = resource.network.main ip_address = "10.0.1.50" aliases = ["registry-cache.local"] }}