This content is associated with a legacy version of the Replicated product. For the current Replicated product docs, click here.
The components
section of the YAML defines how the containers will be created and started. A component is
a group of one or more containers that are guaranteed to run on the same node.
An example of a component using the common options is below. We’ve also create an example of a component and container that uses every possible option in our examples.
components:
- name: Worker
containers:
- source: replicated
image_name: worker
version: 1.0.1
name: worker
ports:
- private_port: "8080"
public_port: "80"
volumes:
- host_path: /opt/myapp/worker
container_path: /state
env_vars:
- name: REDIS_URI
value: 'redis://{{repl NodePrivateIPAddress "Redis" "redis"}}:{{repl ContainerExposedPort "Redis" "redis" "6379"}}
component
All containers are defined under components. A component is a definition of one or more containers, colocated on the same host. When using clustering in the Replicated Native Scheduler, a component is placed on a node and a component is the object that can be scaled up and down as needed.
A component is required to have a name, but can include an optional values documented in the clustering section of these docs.
containers
The containers
key is an array of all Docker containers that belong to this component. There’s no limit on the number of containers you can create in a component. For each container, there’s some basic required information:
source
The source
field is a reference to the Docker registry where this container image can be pulled from.
If using the Replicated Registry, set this to source: replicated
. Nothing else is required; the Replicated Native Scheduler will find the image from the license file and have access to it.
If referencing a public image that doesn’t require any authentication to pull, set this to source: public
. Replicated will automatically pull this image when needed.
If referencing a private image that requires authentication and is stored on a non-Replicated registry (Docker Hub, Quay.io, etc), then this should be set to the “reference” name you used when adding the registry to the vendor portal. For example, if I set up an external registry and named it dockerhub
, then this should be set to source: dockerhub
.
image_name
The image_name
key is the name of the image to be pulled. The format of this varies a little depending on the image source
type:
- When
source: "replicated"
, this should be just the image name, without any hostname or namespace.
- source: replicated
image_name: worker
- When
source: "public"
, this should be set to the full URI of the image, including the hostname and namespace (if required).
- source: public
image_name: redis
- source: public
image_name: docker.elastic.co/elasticsearch/elasticsearch
- When
source: "<custom>"
, this should be set to the namespace and image name, but exclude the hostname.
- source: dockerhub
image_name: myorg/worker
version
The version
key is the tag of the docker image. If missing, it will follow the Docker convention of using latest
.