Docker.Names (docker v0.4.0)

Link to this section Summary

Functions

Ensures a name is prefixed with a "/" for matching against Docker's API.

Sanitizes a name for use with Docker. Docker doesn't support / in names, so convert them to underscores.

Returns the tag of a Docker image given its name.

Divides an image name into a tuple of {registry, repo, image}.

Link to this section Functions

Ensures a name is prefixed with a "/" for matching against Docker's API.

Link to this function

container_safe(name)

Sanitizes a name for use with Docker. Docker doesn't support / in names, so convert them to underscores.

Examples

iex> Docker.Names.container_safe("foo")
"foo"

iex> Docker.Names.container_safe("foo/bar/bacon")
"foo_bar_bacon"

iex> Docker.Names.container_safe("foo_bar")
"foo_bar"
Link to this function

extract_tag(image)

Returns the tag of a Docker image given its name.

Examples

iex> Docker.Names.extract_tag("foo")
"latest"

iex > Docker.Names.extract_tag("foo:bar")
"bar"

iex > Docker.Names.extract_tag("foo/bar:bacon")
"bacon"
Link to this function

split_image(image)

Divides an image name into a tuple of {registry, repo, image}.

Examples

iex> Docker.Names.split_image("quay.io/wildcard/rabbitmq")
{"quay.io", "wildcard", "rabbitmq"}

iex> Docker.Names.split_image("dockerfile/rabbitmq")
{"index.docker.io", "dockerfile", "rabbitmq"}

iex> Docker.Names.split_image("ubuntu")
{"index.docker.io", "_", "ubuntu"}