Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
brianbrookes-wk opened this issue Jun 13, 2023 · 14 comments
Open

Comments

@brianbrookes-wk
Copy link

brianbrookes-wk commented Jun 13, 2023

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
Copy link

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
Copy link
Author

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
Copy link
Contributor

bsousaa commented Jun 20, 2023

closing the issue

@bsousaa bsousaa closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2023
@brianbrookes-wk
Copy link
Author

brianbrookes-wk commented Jun 20, 2023

Why is this closed? @bsousaa

@brianbrookes-wk
Copy link
Author

@bsousaa Why did you close this?

@neersighted
Copy link
Member

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 neersighted reopened this Jun 27, 2023
@brianbrookes-wk
Copy link
Author

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
Copy link
Author

brianbrookes-wk commented Jul 3, 2023

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
Copy link

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
Copy link
Member

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

franckrasolo added a commit to franckrasolo/dotfiles.nix that referenced this issue Nov 21, 2023
CLI plugins also need to be symlinked as described in docker/for-mac#6876 (comment)
@ricardograca-scratch
Copy link

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

@flyq
Copy link

flyq commented Mar 21, 2024

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
Copy link
Author

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

@spitfire
Copy link

docker/compose#8986 (comment) seems to have worked for me. The error message is confusing, and the order of arguments should not matter (but it does).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants