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

Update for Compatibility with Docker Compose v2 #220

Conversation

taketo1113
Copy link
Contributor

This Pull Request has been created because I found some errors installing TRAM container images with Docker Compose v2.

(1) docker-compose: No such file or directory

This error occurs when starting TRAM container images from the start-container task in Makefile.

For the error details, see the following:

$ make start-container
docker-compose -f docker/docker-compose.yml up -d
make: docker-compose: No such file or directory
make: *** [start-container] Error 1

It uses Docker Compose version v2.29.7 which is installed by Docker Desktop on Mac.
The recommended command-line syntax for Docker Compose v2 is docker compose.
https://docs.docker.com/compose/releases/migrate/#what-are-the-differences-between-compose-v1-and-compose-v2

This Pull Request changes the compose command to replace docker-compose with docker compose.

Additional information

The following Wiki page will also need similar changes.
(If this PR is merged, please update the Wiki accordingly.)
https://github.com/center-for-threat-informed-defense/tram/wiki/Installation

(2) Compose file: Version top-level element (obsolete)

This warning occurs when starting TRAM container images using docker/docker-compose.yml.

The warning details following:

$ docker compose up
WARN[0000] /Users/username/tram-docker/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 

The cause is that the version attribute has been obsoleted.
https://docs.docker.com/reference/compose-file/version-and-name/#version-top-level-element-obsolete

This Pull Request changes to remove the obsolete attribute of version.

@mehaase
Copy link
Contributor

mehaase commented Nov 13, 2024

Looks good. Thank you for submitting this patch.

@mehaase mehaase merged commit 3ba509d into center-for-threat-informed-defense:main Nov 13, 2024
1 check failed
@taketo1113 taketo1113 deleted the update-docker-compose-v2 branch November 13, 2024 01:26
@taketo1113
Copy link
Contributor Author

taketo1113 commented Nov 13, 2024

@mehaase Thank you for merging.

I think it would be good to apply the replacement to the docker compose command on the Installation page of Wiki as well.
Since I don't have edit permissions for Wiki pages, I am attaching a patch file with the changes as a reference.
https://github.com/center-for-threat-informed-defense/tram/wiki/Installation

diff.patch

diff --git a/Installation.md b/Installation.md
index e496e5c..8cdbb61 100644
--- a/Installation.md
+++ b/Installation.md
@@ -19,7 +19,7 @@
     * Run this command from the same directory where you downloaded
       `docker-compose.yml`:
         ```shell
-        $ docker-compose up
+        $ docker compose up
         ```
     * The first time you run this command, it will download about 1GB of Docker
       images. This requires a connection to the internet. If your environment
@@ -36,7 +36,7 @@
    the password that you specified in `docker-compose.yml`.
    ![Screenshot 2023-08-27 at 7 26 18 PM](https://github.com/center-for-threat-informed-defense/tram/assets/320904/1da07cce-7d7b-4deb-8e0c-0b87ce1b9e9c)
 
-6. To shut down TRAM, type <kbd>Ctrl+C</kbd> in the shell where `docker-compose
+6. To shut down TRAM, type <kbd>Ctrl+C</kbd> in the shell where `docker compose
    up` is running.
 
 # Environment Variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants