class

Testcontainers::RedisContainer

Inherits Testcontainers::DockerContainer < Reference < Object

RedisContainer provides a pre-configured container for Redis.

Example:

container = Testcontainers::RedisContainer.new
container.start

host = container.host
port = container.mapped_port(6379)
url = container.redis_url

container.stop
container.remove

Constants

REDIS_DEFAULT_IMAGE = "redis:latest"
REDIS_DEFAULT_PORT = 6379

Constructors

new(image : String = REDIS_DEFAULT_IMAGE, password : String | Nil = nil)
Source

Instance methods

database_url

Alias for redis_url.

Source
password
Source
port

Returns the default Redis port.

Source
redis_url(protocol : String = "redis", db : Int32 = 0) : String

Returns the Redis connection URL.

Example: "redis://:password@localhost:6379/0" or "redis://localhost:6379/0"

Source
start

Starts the container with the default Redis port exposed.

Source
with_password(password : String) : self

Sets the password for Redis.

Source