# Docker compose unknown flags

**URL:** <https://forums.docker.com/t/docker-compose-unknown-flags/132524>\
**Category:** Compose\
**Tags:** docker\
**Created:** [December 5, 2022, 6:36pm UTC](https://forums.docker.com/t/docker-compose-unknown-flags/132524 "2022-12-05T18:36:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ealmonte32](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ealmonte32/32/33179_2.png) [@ealmonte32](https://forums.docker.com/u/ealmonte32)\
**Post date:** [December 5, 2022, 6:36pm UTC](https://forums.docker.com/t/docker-compose-unknown-flags/132524/1 "2022-12-05T18:36:11Z")

</div>

Getting unknown flag for `--no-cache` and trying to rebuild containers.

I read that part of the manual, this used to work before the `docker-compose` was deprecated and now we have to use `docker compose`.

But I am having a hard time building containers without cache/rebuilding…  
Using package docker-compose-plugin version 2.12 for raspbian…

This is the outcome of `docker compose -f`:

 ![image](https://global.discourse-cdn.com/docker/original/3X/d/d/dda6f97523db8a06e06f979b06e721f88e268efd.png)

where is the no-cache option? or the force-recreate option?

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [December 5, 2022, 6:50pm UTC](https://forums.docker.com/t/docker-compose-unknown-flags/132524/2 "2022-12-05T18:50:39Z")

</div>

Next time, please share the text itself, instead of a screenshot of the text.

The option `--no-cache` still exists for `docker compose build`:

```auto
me@host:~$ docker compose build --help

Usage: docker compose build [OPTIONS] [SERVICE...]

Build or rebuild services

Options:
      --build-arg stringArray Set build-time variables for services.
      --no-cache Do not use cache when building the image
      --progress string Set type of progress output (auto, tty, plain, quiet) (default "auto")
      --pull Always attempt to pull a newer version of the image.
  -q, --quiet Don't print anything to STDOUT
      --ssh string Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent)

```

---

<div class="post-metadata">

**Author:** ![ealmonte32](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ealmonte32/32/33179_2.png) [@ealmonte32](https://forums.docker.com/u/ealmonte32)\
**Post date:** [December 5, 2022, 9:46pm UTC](https://forums.docker.com/t/docker-compose-unknown-flags/132524/3 "2022-12-05T21:46:39Z")

</div>

Thanks, but I needed to pass the file flag since I am having two `docker-compose.yml` files as parameters… and i wanted to make sure that they were built without cache.  
Every time I was typing `docker compose build -f docker-compose.yml` I was getting that error `unknown shorthand flag: 'f' in -f`, but I just got it now with  
`docker compose -f /home/pi/docker-compose.yml build --no-cache`

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [December 6, 2022, 10:44am UTC](https://forums.docker.com/t/docker-compose-unknown-flags/132524/4 "2022-12-06T10:44:15Z")

</div>

> [@ealmonte32](#):
>
> Every time I was typing `docker compose build -f docker-compose.yml` I was getting that error `unknown shorthand flag: 'f' in -f`

@meyay only talked about the `--no-cache` flag. `-f` is still a parameter of `compose` as it is required for all subcommand when you change the default compose file path. Some programs let you use the `global options` after the subcommands. I guess that was what confused you.

---

<div class="post-metadata">

**Author:** ![hoohost](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/hoohost/32/32461_2.png) [@hoohost](https://forums.docker.com/u/hoohost)\
**Post date:** [February 21, 2023, 3:35am UTC](https://forums.docker.com/t/docker-compose-unknown-flags/132524/5 "2023-02-21T03:35:52Z")

</div>

It says the `--progress` flag is valid but I’m getting `unknown flag: --progress` in docker 23.0.0, docker compose 2.15.1

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [February 21, 2023, 6:13pm UTC](https://forums.docker.com/t/docker-compose-unknown-flags/132524/6 "2023-02-21T18:13:23Z")

</div>

I just tried it on docker 23.0.1, compose plugin v2.16.0.

`--progress plain`:

```auto
me@docker:~/btest$ docker compose build --progress plain
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 254B done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/library/alpine:latest
#3 DONE 0.0s

#4 [build2 1/3] FROM docker.io/library/alpine
#4 DONE 0.0s

#5 [build1 3/3] RUN sleep 10
#5 CACHED

#6 [build1 2/3] RUN touch /opt/binary1
#6 CACHED

#7 [final 2/3] COPY --from=build1 /opt/binary1 /opt/
#7 CACHED

#8 [build2 3/3] RUN sleep 10
#8 CACHED

#9 [build2 2/3] RUN touch /opt/binary2
#9 CACHED

#10 [final 3/3] COPY --from=build2 /opt/binary2 /opt/
#10 CACHED

#11 exporting to image
#11 exporting layers done
#11 writing image sha256:41be958e9075235ec46bce1589e08dcc0677c4ea1a58bff079f37b64925dd9ed done
#11 naming to docker.io/library/test done
#11 DONE 0.0s
```

`--progress auto`:

```auto
me@docker:~/test$ docker compose build --progress auto
[+] Building 0.0s (11/11) FINISHED
 => [internal] load build definition from Dockerfile 0.0s
 => => transferring dockerfile: 254B 0.0s
 => [internal] load .dockerignore 0.0s
 => => transferring context: 2B 0.0s
 => [internal] load metadata for docker.io/library/alpine:latest 0.0s
 => [build2 1/3] FROM docker.io/library/alpine 0.0s
 => CACHED [build1 2/3] RUN touch /opt/binary1 0.0s
 => CACHED [build1 3/3] RUN sleep 10 0.0s
 => CACHED [final 2/3] COPY --from=build1 /opt/binary1 /opt/ 0.0s
 => CACHED [build2 2/3] RUN touch /opt/binary2 0.0s
 => CACHED [build2 3/3] RUN sleep 10 0.0s
 => CACHED [final 3/3] COPY --from=build2 /opt/binary2 /opt/ 0.0s
 => exporting to image 0.0s
 => => exporting layers 0.0s
 => => writing image sha256:7d19a75c1f13009c7e47626b94a60e830b293195e409b8ed798f4c16011ac7d5 0.0s
 => => naming to docker.io/library/test 0.0s
```

Please upgrade your engine to 23.0.1 and see whether it fixes it.
