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

[#357] Fix: docker compose command is not working as expected #504

Merged
merged 12 commits into from
Apr 11, 2024

Conversation

sanG-github
Copy link
Contributor

@sanG-github sanG-github commented Jan 25, 2024

What happened 👀

Update the docker-compose from v1 to docker compose v2. 🚀

Update the APP_NAME to use hyphen instead of underscore when it comes to container_name.

Insight 📝

When changing the docker-compose from version 1 to version 2, the gist is that they keep the container name to be a valid name for DNS hostnames with hyphen (-) as a separator instead of underscore (_) as before. (ref)

Note

With the APP_NAME = rails_template

For the current codebase, we previously used underscore for all the container names primarily, such as:

  • rails_template_test_run_9ae09012e3d0
  • rails_template_redis

But after changing docker-compose to a newer version without any additional modifications, those container names become:

  • rails_template-test-run-9ae09012e3d0
  • rails_template-redis

-> So we need to update all container names to be consistent with that convention, using only hyphen.

Caution

We previously tried to find the test run container by the name, but it was used with underscore -> challenge when switching to use hyphen as it keeps raising the container name not found.

I tried to log some information when the test flow was running, but it looked weird.

In this workflow run, the log returns a list of the container name and ID respectively. And we can get the ID from the container name as show below:

image

But after changing it to hyphen, with the same approach, we cannot retrieve that container ID in this workflow run.

image

Proof Of Work 📹

Built and renamed the docker image successfully
image

@sanG-github sanG-github added this to the 5.13.0 milestone Jan 25, 2024
@sanG-github sanG-github self-assigned this Jan 25, 2024
@sanG-github sanG-github force-pushed the bug/gh357-compose-v2 branch 12 times, most recently from 32a54e3 to 0bd40bf Compare January 30, 2024 08:28
@sanG-github sanG-github force-pushed the bug/gh357-compose-v2 branch 3 times, most recently from aad4236 to 18c7581 Compare March 13, 2024 07:51
@sanG-github sanG-github force-pushed the bug/gh357-compose-v2 branch from a5b5499 to 1be7c94 Compare March 13, 2024 08:11
@sanG-github sanG-github marked this pull request as ready for review March 13, 2024 10:28
@malparty malparty modified the milestones: 5.13.0, 5.14.0 Mar 14, 2024
Copy link
Member

@malparty malparty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just not sure about the last usage of APP_NAME 👀

.template/spec/support/serverspec.rb Show resolved Hide resolved
Copy link
Contributor

@khangbui22 khangbui22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@malparty malparty added this pull request to the merge queue Apr 11, 2024
Merged via the queue into develop with commit e1afdc2 Apr 11, 2024
5 checks passed
@malparty malparty deleted the bug/gh357-compose-v2 branch April 11, 2024 01:06
@malparty malparty mentioned this pull request Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix: docker compose command is not working as expected
3 participants