Skip to content

--rm flag added after image argument #26

@DhavalGojiya

Description

@DhavalGojiya

📋 Description

The action generates a docker run command where the --rm flag is placed after the image name.
Docker interprets anything after the image as a container command/argument to the entrypoint (Redis), instead of a valid docker run option.

As a result:

  • Container starts but immediately exits because Redis tries to parse --rm as a config directive.
  • Redis never runs successfully.
  • Container cleanup doesn’t happen as expected.

❌ Wrong command

docker run --name redis --publish 6379:6379 --detach redis:7 --rm

🔥 Error at runtime

*** FATAL CONFIG FILE ERROR (Redis 7.4.5) ***
Reading the configuration file, at line 2
>>> 'rm'
Bad directive or wrong number of arguments
  • Container starts but exits immediately.
  • --rm is treated as a Redis [CMD] argument, not a Docker flag.
  • Leaves broken behavior in pipelines.

📸 Portainer screenshot: Image


🧩 How to reproduce

Using the action in a workflow like this fails:

- name: Start Redis
  uses: supercharge/redis-github-action@1.8.0
  with:
    redis-version: redis:7
    redis-remove-container: true

📍 Root cause

⚠️ The bug is entirely due to argument ordering in the docker run command.

  • Expected:

    docker run --rm redis:7
  • Actual:

    docker run redis:7 --rm

This happens because --rm is appended after the image argument in Code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions