for-mac icon indicating copy to clipboard operation
for-mac copied to clipboard

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

Open brianbrookes-wk opened this issue 2 years ago • 15 comments

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

brianbrookes-wk avatar Jun 13 '23 16:06 brianbrookes-wk

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

trungutt avatar Jun 15 '23 14:06 trungutt

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

brianbrookes-wk avatar Jun 15 '23 17:06 brianbrookes-wk

closing the issue

bsousaa avatar Jun 20 '23 09:06 bsousaa

Why is this closed? @bsousaa

brianbrookes-wk avatar Jun 20 '23 14:06 brianbrookes-wk

@bsousaa Why did you close this?

brianbrookes-wk avatar Jun 20 '23 16:06 brianbrookes-wk

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.

neersighted avatar Jun 27 '23 12:06 neersighted

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 avatar Jun 27 '23 15:06 brianbrookes-wk

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.

brianbrookes-wk avatar Jul 03 '23 20:07 brianbrookes-wk

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

spencercornish-wk avatar Nov 13 '23 19:11 spencercornish-wk

/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.

neersighted avatar Nov 13 '23 19:11 neersighted

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

ricardograca-scratch avatar Feb 13 '24 12:02 ricardograca-scratch

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.

flyq avatar Mar 21 '24 13:03 flyq

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

brianbrookes-wk avatar Apr 16 '24 21:04 brianbrookes-wk

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).

spitfire avatar Apr 26 '24 20:04 spitfire

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.

lukaszw-at-itstartechs avatar Jul 17 '24 10:07 lukaszw-at-itstartechs