buildkite-plugins / docker-compose-buildkite-plugin

🐳⚡️ Run build scripts, and build + push images, w/ Docker Compose
MIT License
172 stars 138 forks source link

Docker compose: 5.2.0 - unknown shorthand flag: 'f' in -f #439

Closed moribaleta closed 1 month ago

moribaleta commented 4 months ago

Hi Guys Im trying to use 5.2.0 coming from 3.9.0 I'm getting this error on buildkite


Building services build-${BUILDKITE_BRANCH}-${BUILDKITE_BUILD_NUMBER}-${BUILDKITE_COMMIT} | 0s
-- | --
  | $ docker compose -f docker-compose.yml -p buildkite018f75692ece423b91a4b2fc60fba6c6 build --pull build-${BUILDKITE_BRANCH}-${BUILDKITE_BUILD_NUMBER}-${BUILDKITE_COMMIT}
  | unknown shorthand flag: 'f' in -f

any thoughts on whats causing the issue

this is my step in pipeline.yml

steps:
  - label: ":docker: Build image on host"
    branches: "development staging alpha beta gamma master"
    plugins:
      - ecr#v2.9.0:
          login: true
          region: "us-east-1"
          no-include-email: true
      - docker-compose#v5.2.0:
          build: "build-${BUILDKITE_BRANCH}-${BUILDKITE_BUILD_NUMBER}-${BUILDKITE_COMMIT}"
          push: ****
          config: docker-compose.yml
          env:
            - BUILDKITE_BRANCH
lucassus commented 3 months ago

I have a similar issue:

docker compose -f .buildkite/docker-compose.buildkite.yml -p buildkite01902f5ee1bf44b2b9b7420ae359e365 -f docker-compose.buildkite-109425-override.yml build --pull ...
--
  | unknown shorthand flag: 'f' in -f
  | See 'docker --help'.

Later in the logs:


Management Commands:
--
  | builder     Manage builds
  | buildx*     Docker Buildx (Docker Inc., v0.7.1)
  | config      Manage Docker configs
  | container   Manage containers
  | context     Manage contexts
  | image       Manage images
  | manifest    Manage Docker image manifests and manifest lists
  | network     Manage networks

It looks like docker compose v2 is not accessbile for some reason and docker command does not recognize it.

toote commented 1 month ago

This is extremely strange and not something I have experienced or seen before. The most likely explanation I can think of is that compose is not recognized as a valid docker plugin or is corrupt in some way (like when there are shims to pass through compose V1 to V2 plugins).

Could any further information be provided with regards your execution environments? Are you running in AWS using a standard AMI? What version of docker? What version of docker compose? How were they installed? What version of the agent? How was it installed? Was it installed after or before docker? Any steps that are working and these are not? 🤯

yahonda commented 1 month ago

Installing the Docker Compose plugin should address this issue.

https://docs.docker.com/compose/install/linux/#install-using-the-repository

snolan-amount commented 1 month ago

In the manual install instructions for Docker Compose here https://docs.docker.com/compose/install/linux/#install-the-plugin-manually they give the plugins directory locations. I was getting this same error and I had the docker-compose binary installed in the path (in /usr/local/lib) but not in one of the plugins directories. I put a copy of the docker-compose binary here /usr/local/lib/docker/cli-plugins/docker-compose and it's working fine.