Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker): add default CMD to test stage in Dockerfile #9334

Open
wants to merge 1 commit into
base: fix-docker-home
Choose a base branch
from

Conversation

gustavovalverde
Copy link
Member

@gustavovalverde gustavovalverde commented Mar 18, 2025

Motivation

When running the container using docker-compose without explicitly
providing a command, the entrypoint.sh script was attempting to execute
exec_as_user with no arguments, resulting in a gosu error:

exec_as_user
exec gosu 10001:10001
Usage: gosu user-spec command [args]

Depends-On: #9333

Solution

By adding CMD ["cargo", "test"] to the test stage in the Dockerfile, we ensure a default command is available for the entrypoint script to execute, preventing the gosu error when no command is explicitly provided.

This fix allows docker-compose.test.yml to run successfully without needing to specify a command in the service definition.

Tests

There are no unit tests validating this, but running docker compose -f docker/docker-compose.test.yml up --build will trigger it (without this PR).

PR Checklist

  • The PR name is suitable for the release notes.
  • The solution is tested.
  • The documentation is up to date.
  • The PR has a priority label.
  • If the PR shouldn't be in the release notes, it has the
    C-exclude-from-changelog label.

When running the container using docker-compose without explicitly
providing a command, the entrypoint.sh script was attempting to execute
`exec_as_user` with no arguments, resulting in a gosu error:

```
exec_as_user
exec gosu 10001:10001
Usage: gosu user-spec command [args]
```

By adding `CMD ["cargo", "test"]` to the test stage in the Dockerfile,
we ensure a default command is available for the entrypoint script to
execute, preventing the gosu error when no command is explicitly provided.

This fix allows `docker-compose.test.yml` to run successfully without
needing to specify a command in the service definition.
@gustavovalverde gustavovalverde requested a review from a team as a code owner March 18, 2025 12:36
@gustavovalverde gustavovalverde requested review from arya2 and removed request for a team March 18, 2025 12:36
@gustavovalverde gustavovalverde added C-bug Category: This is a bug A-devops Area: Pipelines, CI/CD and Dockerfiles P-Low ❄️ labels Mar 18, 2025
Copy link
Contributor

mergify bot commented Mar 18, 2025

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 ⛓️ Depends-On Requirements

This rule is failing.

Requirement based on the presence of Depends-On in the body of the pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles C-bug Category: This is a bug P-Low ❄️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant