Skip to content

RedisContainer does not accept arbitrary setup commands #1150

@danilofuchs

Description

@danilofuchs

Expected Behaviour

Running tests with Redis, we want to run the DB in-memory to save time and resources.

Using withCommand does not apply the commands correctly

const redis = await new RedisContainer("redis:7")
    .withCommand(["redis-server", "--save", "0", "--appendonly", "no"])
    .start()

Actual Behaviour

The container always runs with the default arguments:

this.withCommand(["redis-server", ...redisArgs]);

Testcontainer Logs
...

Steps to Reproduce
Create a test container with arguments:

const redis = await new RedisContainer("redis:7")
    .withCommand(["redis-server", "--save", "0", "--appendonly", "no"])
    .start()

Log the actual arguments in the redis-container file

Environment Information

  • Operating System: Pop_OS 22.04
  • Docker Version: 28.4.0
  • Node version: 22.18.0
  • Testcontainers version: 11.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions