Skip to content

Conversation

@nialdaly
Copy link
Contributor

@nialdaly nialdaly commented May 22, 2022

Summary

This PR includes changes made to replace the Docker Compose command, docker-compose with docker compose for the proposed upgrade to Docker Compose V2. This is a proposed solution to issue 1048.

@nialdaly nialdaly changed the title docker-compose command changed to docker compose docker-compose command changed to docker compose for upgrade to Docker Compose V2 May 22, 2022
@yariksheptykin
Copy link

LGTM. Thanks for taking care of #1048 !

@nialdaly
Copy link
Contributor Author

nialdaly commented May 24, 2022

Thanks! @yariksheptykin I've updated the runDockerComposeE function in modules/docker/docker_compose.go in an effort to fix the failing tests. I lowercased t.Name() since Docker Compose enforces that --project-name be lowercase.

I've also removed the version property from the docker-compose.yml files, as suggested!

@denis256
Copy link
Member

I think this PR will require additional work to install "docker compose v2" inside of test images

Related failed tests in CI:

TestDockerComposeStdoutExample
Failed
    docker_compose.go:22: error while running command: exec: "docker compose": executable file not found in $PATH; 


TestPackerDockerExampleLocal
Failed
TestPackerDockerExampleLocal 2022-05-24T12:17:56Z logger.go:66: Running Packer to generate a custom artifact for template ../examples/packer-docker-example/build.pkr.hcl
TestPackerDockerExampleLocal 2022-05-24T12:17:56Z logger.go:66: Creating a temporary directory for Packer plugins
TestPackerDockerExampleLocal 2022-05-24T12:17:56Z logger.go:66: Running command packer with args [-version]
TestTerraformAwsHelloWorldExample 2022-05-24T12:17:56Z retry.go:91: terraform [init -upgrade=false]
TestTerraformAwsHelloWorldExample 2022-05-24T12:17:56Z logger.go:66: Running command terraform with args [init -upgrade=false]
    docker_compose.go:22: error while running command: exec: "docker compose": executable file not found in $PATH; 
TestPackerDockerExampleLocal 2022-05-24T12:18:46Z logger.go:66: Running command docker compose with args [--project-name TestPackerDockerExampleLocal down]
    docker_compose.go:22: error while running command: exec: "docker compose": executable file not found in $PATH; 

@nialdaly
Copy link
Contributor Author

@denis256 Is this something that I can do or is it CircleCI related? I'm just not sure what you mean by "test images". Thanks!

@yariksheptykin
Copy link

yariksheptykin commented May 28, 2022

@nialdaly I'm not a big CicleCI expert, but I thing we will need to install compose plugin for docker in a similarly to how we install buildx in the CI. I expect that this can be accomplished by duplicating buildx block and adjusting it for installing compose.

Something like this I imagine:

env: &env
  environment:
    DOCKER_CONFIG: ~/.docker/
    DOCKER_COMPOSE_VERSION: v2.5.0

...
# Installation script for docker compose plugin. See: https://docs.docker.com/compose/install/#install-compose-on-linux-systems
install_docker_compose: &install_docker_compose
  name: install docker compose
  command: |
    mkdir -p $DOCKER_CONFIG/cli-plugins
   curl -SL https://github.com/docker/compose/releases/download/"$DOCKER_COMPOSE_VERSION"/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
    chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
    chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
    docker compose version

...
  test:
...
      - run:
          <<: *install_docker_compose

This is just a thought experiment thought, this CI config might not work.

@nialdaly
Copy link
Contributor Author

Thanks for the guidance! @yariksheptykin I've made a change to the .circleci/config.yml based on your suggestion, fingers crossed.

@denis256
Copy link
Member

CI job failed, on step install docker compose

chmod: cannot access '/usr/local/lib/docker/cli-plugins/docker-compose': No such file or directory

@denis256
Copy link
Member

Failed tests seems unrelated with changes from PR

@nialdaly nialdaly requested a review from denis256 June 10, 2022 18:40
@denis256 denis256 merged commit 78b2903 into gruntwork-io:master Jul 11, 2022
@nialdaly nialdaly deleted the upgrade-docker-compose-v2 branch July 13, 2022 19:27
@yariksheptykin
Copy link

@nialdaly thanks for implementing v2 support!

@nialdaly
Copy link
Contributor Author

No problem, thanks @yariksheptykin and @denis256 for the guidance!

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.

3 participants