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 { id = resource.network.main.meta.id }}Full Syntax
Section titled “Full Syntax”resource "image_cache" "main" { registry { hostname = "private.registry.com"
auth { username = "myuser" password = "mypassword" } }
network { id = resource.network.main.meta.id 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 |
Computed Fields
Section titled “Computed Fields”| Field | Type | Description |
|---|---|---|
meta.id | string | Full resource identifier |
Nested Blocks
Section titled “Nested Blocks”registry
Section titled “registry”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
Section titled “network”Network attachment configuration for the cache container.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Network resource ID to attach to |
ip_ | string | Static IP address to assign | |
aliases | []string | Network aliases for the container |
Examples
Section titled “Examples”Simple Cache with Network
Section titled “Simple Cache with Network”resource "image_cache" "main" { network { id = resource.network.lab.meta.id }}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 = var.registry_password } }
network { id = resource.network.main.meta.id ip_address = "192.168.1.50" aliases = ["registry-cache.local"] }}