docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 118 forks source link

docker compose -f FILE_PATH fails: unknown shorthand flag: 'f' in -f #6876

Open brianbrookes-wk opened 1 year ago

brianbrookes-wk commented 1 year ago

Description

After installing Docker Dashboard on a fresh Macbook M1 Max, when I try to run a docker compose command with a -f PATH_TO_FILE from the command line, docker fails with the following error:

unknown shorthand flag: 'f' in -f

Examples:

unknown shorthand flag: 'f' in -f
See 'docker --help'.

Reproduce

  1. Fresh install Docker Dashboard on a Macbook. (make sure you do NOT have docker-compose installed).
  2. create a valid compose file (example attached)
  3. run docker compose -f path/to/your/compose.yaml

Expected behavior

The stack is created.

docker version

Client:
 Cloud integration: v1.0.33
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:51:16 2023
 OS/Arch:           darwin/arm64
 Context:           default

Server: Docker Desktop 4.20.1 (110738)
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:50:59 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    24.0.2
 Context:    default
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 24.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.49-linuxkit-pr
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 5
 Total Memory: 15.61GiB
 Name: docker-desktop
 ID: 8dcdfa40-36f5-4ade-a345-af775f5f3fb3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Diagnostics ID

196C0AA9-CD1A-4199-A837-18652F38700A/20230613163359

Additional Info

No response

trungutt commented 1 year ago

I believe we need a command right? According to the documentation https://docs.docker.com/compose/reference/#command-options-overview-and-help

docker compose [OPTIONS] COMMAND

brianbrookes-wk commented 1 year ago

Yeah, sorry, I trimmed that off with the rest of the -f args and forgot to put it back in for this report. I get it while using config or up (only two I tried). docker compose -f path/to/your/compose.yaml config
or docker compose -f path/to/your/compose.yaml up

bsousaa commented 1 year ago

closing the issue

brianbrookes-wk commented 1 year ago

Why is this closed? @bsousaa

brianbrookes-wk commented 1 year ago

@bsousaa Why did you close this?

neersighted commented 1 year ago

Looks like this was closed by mistake. I have been unable to reproduce this myself, so any more insight into your environment you can provide would be helpful.

brianbrookes-wk commented 1 year ago

Several of my devs (and myself) run into this on our new M1 Macbooks (not sure if that has any bearing). We all ran into this if the "docker-compose" plugin is NOT installed. When we install it (brew install docker-compose) this issue goes away.

brianbrookes-wk commented 1 year ago

It seems like the compose plugin is not getting the sim link setup correctly. But that is just a guess at this point. I have not had any others hit me up with this situation.

spencercornish-wk commented 10 months ago

I believe I found the issue here and a proper workaround, maybe one of the docker devs can chime in on a better fix.

Essentially, on install the symlink present in /usr/local/lib/docker isn't being created. In fact, the whole directory is absent. We completely fixed the issue by running the following two commands:

sudo mkdir -p /usr/local/lib/docker sudo ln -s /Applications/Docker.app/Contents/Resources/cli-plugins /usr/local/lib/docker/cli-plugins

I'm not sure why the installer would skip this, it worked on my M1 Mac, but not on a coworker's. It seems like it could be something on the mac blocking it, or maybe a regression earlier this year?

FYI @brianbrookes-wk @neersighted

neersighted commented 10 months ago

/usr/local/lib/docker shouldn't exist on macOS, the symlink goes in ~/.docker/cli-plugins. Given this seems to be the symlink, let me see if I can find the Docker team that owns this and ask them to take a look.

ricardograca-scratch commented 7 months ago

Had the exact same issue on Ubuntu 22.04.3. Installing docker-compose-plugin fixed it.

flyq commented 6 months ago

At first, I used command which works fine in 2021:

sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker --version

and meet this issue, then, I install the docker again according official suggestion: https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository, I even don't uninstall the origin version. and it fixed my problem.

brianbrookes-wk commented 5 months ago

@neersighted Were you able to find the correct Docker team?
@ricardograca-scratch and @flyq solutions are for Linux and not OSX.

spitfire commented 5 months ago

https://github.com/docker/compose/issues/8986#issuecomment-1015065858 seems to have worked for me. The error message is confusing, and the order of arguments should not matter (but it does).

lukaszw-at-itstartechs commented 2 months ago

This is an issue with old docker compose plugin. You download with brew the newer plugin and set it up in config to use the brew version.