简体   繁体   中英

Docker compose on ecr: ERROR: No such service: --build-arg

I try to pass arg into the docker build process in this command:

docker-compose -f .docker/docker-compose.ecr.yml build my-app --build-arg BUILD_VERSION=5.0.0

But I got error:

ERROR: No such service: --build-arg

According to the docs docker-compose have build-arg parameter.

The yml file:

version: '3'

services:
  my-app:
    image: 3144.dkr.ecr.us-east-2.amazonaws.com/my-app:latest
    build:
      context: ../
      dockerfile: ./.docker/Dockerfile

What can be the problem?

The services should be last in the command line.

$ docker-compose build --help
Usage: build [options] [--build-arg key=val...] [SERVICE...]

So:

$ docker-compose -f .docker/docker-compose.ecr.yml build --build-arg BUILD_VERSION=5.0.0 my-app 

I had a similar issue but it was Visual Studio 2019 that was trying to publish and putting the build my-app before the 'build-arg' parameter.

All I had to do is to update VS 2019 to the latest version 16.11.0 that solved this error during the publish from the IDE.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM