0

How to pass build argument for "up" command

docker-compose up -d --build server_name --build-arg FOO=1

--build-arg is invalid.

Have to use two commands: build image first, then "up".

eastwater
  • 4,624
  • 9
  • 49
  • 118
  • 1
    `docker-compose build server_name --build-arg FOO=1 && docker-compose up -d server_name`. This is a one liner, arguably not one command, but since `docker-compose up` does not have a [`build-arg`](https://docs.docker.com/engine/reference/commandline/compose_up/#options) flag, that's probably the best you could go with, without changing your _docker-compose.yml_ – β.εηοιτ.βε Apr 28 '23 at 07:49

0 Answers0