Skip to content

You are viewing documentation for Instruqt 2.0 Labs. For Tracks documentation, please visit docs.instruqt.com.

Image Cache


Defined insandbox.hcl

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" {
network {
id = resource.network.main.meta.id
}
}
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

FieldTypeRequiredDescription
registryblock—Additional registries to cache images fromrepeatable
networkblock—Connect this resource to a specific network so it can communicate with other containers or servicesrepeatable

Registry

image_cache→Registry

Additional registries to cache images from

FieldTypeRequiredDescription
hostnamestring✓Hostname of the container registry
authblock—Authentication credentials for the registry

Auth

image_cache→Registry→Auth

Authentication credentials for the registry

FieldTypeRequiredDescription
hostnamestring—Hostname for authentication
usernamestring✓Username for authentication
passwordstring✓Password for authentication

Network

image_cache→Network

Network attachments for the image cache

FieldTypeRequiredDescription
idstring—ID of the network to attach the container
targetreferencenetwork—The network to attach the container to
ip_addressstring—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)
aliaseslist(string)—Aliases allow alternate names to specified for the container

Computed Attributes

These attributes are set by the system and are read-only.

AttributeTypeDescription
network[].namestringName will equal the name of the network as created by jumppad
network[].assigned_addressstringAssignedAddress will equal if IPAddress is set, else it will be the value automatically assigned from the network
FieldTypeDescription
meta.idstringFull resource identifier

Configure additional registries for the image cache.

FieldTypeRequiredDescription
hostnamestring✓Hostname of the registry
authblockAuthentication configuration for the registry

Authentication configuration for a registry.

FieldTypeRequiredDescription
hostnamestringHostname for authentication (can differ from registry hostname)
usernamestring✓Username for authentication
passwordstring✓Password for authentication

Network attachment configuration for the cache container.

FieldTypeRequiredDescription
idstring✓Network resource ID to attach to
ip_addressstringStatic IP address to assign
aliases[]stringNetwork aliases for the container
resource "image_cache" "main" {
network {
id = resource.network.lab.meta.id
}
}
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"]
}
}