suggests that the version of docker compose you're running locally is not recognizing the -f flag as valid. This typically happens due to one of the following reasons:
✅ Root Cause
The issue lies in how the docker compose command is being interpreted — specifically, whether you're using:
Docker CLI with Compose plugin (docker compose) ✅
Podman mimicking Docker (e.g., via podman-docker) ❌
But in your case, you mentioned both environments use podman-docker, so let’s clarify what might be happening.
🔍 Likely Explanation
You're running:
bash
docker compose -f docker-compose.yml up --build -d
But in some environments, docker compose is not calling the Docker Compose V2 plugin, but instead calling a different binary or alias — such as the older docker-compose (Python-based), or a wrapper script that doesn't support the same flags.
🧪 Diagnostic Step
Run:
bash
which docker compose
Wait — actually, that won't work as expected. Do this instead:
bash
type docker
type docker-compose
type docker compose
Also:
bash
docker compose version
And compare that with:
bash
docker version
If docker compose version fails or says something like "unknown shorthand", it's likely that docker compose is not invoking the Compose V2 plugin correctly.
Also try:
bash
alias docker
To see if docker is aliased to something like podman.
💡 Most Probable Cause in Your Case
Your local machine is likely using Podman with a shim that aliases docker to podman, and the version of Podman you're using does not fully support the docker compose syntax, especially with the -f flag.
Even though both systems say they use podman-docker, the implementation may differ:
System
docker command actually points to
Supports docker compose -f?
Company Server
Docker Engine (or Podman with full Compose plugin)
✅ Yes
Local Machine
Podman (incomplete Docker-compatible shim)
❌ No
✅ Solution
Option 1: Use Full Compose Command
Instead of:
bash
docker compose -f docker-compose.yml ...
Try:
bash
docker compose --file docker-compose.yml ...
⚠️ Even that may fail depending on the Compose support.
Alternatively, run:
bash
docker compose version
If that fails with “command not found” or “unknown flag”, then you're not using Compose V2 plugin.
Option 2: Use Podman Directly with Compose
If you're using Podman, and your version supports podman-compose, try:
bash
podman-compose -f docker-compose.yml up -d
Note: This requires podman-compose to be installed separately. It is not the same as docker compose.
To check:
bash
podman-compose --version
Option 3: Ensure Docker Compose V2 Plugin is Installed Locally
On your local machine, install the official Docker Compose V2 plugin:
Would you like help checking which version of Podman or Compose you have locally? You can paste the output of these:
bash
podman --version
docker version
docker compose version 2>/dev/null || echo "Compose V2 not installed"
which docker
type docker
User
rying to overwrite '/usr/bin/docker', which is also in package podman-docker 3.4.4+ds1-1ubuntu1.22.04.3
Assistant
Ah — this is the key issue! You're seeing this error:
code
trying to overwrite '/usr/bin/docker', which is also in package podman-docker 3.4.4+ds1-1ubuntu1.22.04.3
This means you're trying to install the official Docker CLI (which provides docker compose) alongside podman-docker, which also installs a binary at /usr/bin/docker. On Ubuntu-based systems, this causes a file conflict, because two packages are trying to own the same file path.
🔍 Why This Happens
podman-docker provides a shim binary at /usr/bin/docker that forwards commands to Podman, to mimic Docker CLI behavior.
When you try to install the official Docker Engine or Docker Compose CLI plugin, they also try to install /usr/bin/docker, and Ubuntu prevents this to avoid breaking things.
So essentially:
Your system thinks docker = Podman (via podman-docker)
You're trying to make docker = Real Docker (with Compose V2 support)
But they can't both live at /usr/bin/docker
✅ Solutions
You have several options depending on what you want to achieve:
✅ Option 1: Use Podman Compose Instead of Docker Compose
If you're okay continuing with Podman and just want Compose functionality, install podman-compose:
Not 100% compatible with every Docker Compose feature
✅ Option 2: Use Docker Proper (Docker Engine + Docker Compose) on Local Machine
If you need full Docker and Docker Compose V2 support (e.g., for -f flag and other newer features), you should:
Step 1: Uninstall
User
udo apt remove podman-docker
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
docker-ce : Depends: docker-ce-cli but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Assistant
Thanks for sharing that error — it's a common situation when dealing with Docker-related packages on Ubuntu, especially if you've mixed packages from different sources (like Docker's official repo and Ubuntu's default repos).
Let's walk through how to cleanly resolve this so you can either:
✅ Fully switch to Docker (and get docker compose -f support), or
✅ Safely remove Docker and continue using Podman (with podman-compose)
🛠️ Error Explained
code
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
docker-ce : Depends: docker-ce-cli but it is not going to be installed
This means:
docker-ce depends on docker-ce-cli, but apt is refusing to install it
Likely cause: Broken or partially removed packages, or conflicting repos
✅ Step-by-Step Fix
🔹 Step 1: Run the suggested fix (clean up broken state)
bash
sudo apt --fix-broken install
This often resolves dependency issues by removing or reinstalling broken packages.
If that succeeds, great — proceed to Step 2.
If it fails, share the output and we can dig deeper.
🔹 Step 2: Remove podman-docker and any broken Docker packages
sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libflashrom1 libftdi1-2 libllvm13 libnss3-tools
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
docker-ce-cli
Suggested packages:
docker-model-plugin
The following NEW packages will be installed:
docker-ce-cli
0 upgraded, 1 newly installed, 0 to remove and 32 not upgraded.
6 not fully installed or removed.
Need to get 0 B/16.5 MB of archives.
After this operation, 45.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 195051 files and directories currently installed.)
Preparing to unpack .../docker-ce-cli_5%3a28.3.2-1ubuntu.22.04jammy_amd64.deb ...
Unpacking docker-ce-cli (5:28.3.2-1ubuntu.22.04jammy) ...
dpkg: error processing archive /var/cache/apt/archives/docker-ce-cli_5%3a28.3.2-1ubuntu.2
2.04jammy_amd64.deb (--unpack):
trying to overwrite '/usr/bin/docker', which is also in package podman-docker 3.4.4+ds1-1
ubuntu1.22.04.3
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/docker-ce-cli_5%3a28.3.2-1ubuntu.22.04jammy_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Assistant
Thanks for the detailed output — this confirms exactly what's going wrong:
❌ Conflict: docker-ce-cli wants to install /usr/bin/docker, but podman-docker already owns that file.
So even though we cleared some dependencies, podman-docker is still installed, and it's blocking the installation of the real Docker CLI.
✅ Solution: Forcefully Remove podman-docker and Retry
We need to completely purgepodman-docker so it releases /usr/bin/docker, then install Docker properly.
Client: Docker Engine - Community
Version: 28.3.2
...
Server: Docker Engine - Community
Engine:
Version: 28.3.2
...
docker compose version
Docker Compose version v2.23.3
Now this will work as expected:
bash
User
docker-compose.pprd.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion
unable to get image 'beep-pprd': permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.51/images/beep-pprd/json": dial unix /var/run/docker.sock: connect: permission denied
Assistant
Great progress! You're almost there. Now let's break down and resolve the two issues you're encountering:
❗️Issue 1: version is obsolete in docker-compose.pprd.yml
⚠️ Message:
code
the attribute `version` is obsolete, it will be ignored
✅ Explanation:
In Docker Compose V2 (the new plugin format), the version: key at the top of your docker-compose.yml file is no longer needed — and is officially deprecated.
✅ Solution:
Just remove the version: line from your docker-compose.pprd.yml file.
Example before:
yaml
version: '3.8'
services:
web:
image: nginx
Change to:
yaml
services:
web:
image: nginx
This will remove the warning.
❌ Issue 2: Permission Denied When Accessing Docker Socket
⚠️ Message:
code
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
✅ Explanation:
This means your current user does not have permission to talk to the Docker daemon. By default, only the root user and members of the docker group can do this.
Since you're not using sudo, your user isn't part of the docker group yet.
✅ Solution 1: Add Your User to the docker Group (Recommended)
Run this command (replace $USER with your username if needed):
bash
sudo usermod -aG docker $USER
Then log out and log back in, OR run:
bash
newgrp docker
This reloads your group permissions without logging out.
✅ After this, try running Docker again:
bash
docker compose -f docker-compose.pprd.yml up -d
podman-docker
bash
sudo apt remove podman-docker
⚠️ This will not remove Podman itself — just the Docker-compatible CLI shim.
Step 2: Install Docker Engine and Docker Compose Plugin
If you must keep both podman and docker CLI tools coexisting, you could:
Remove /usr/bin/docker from podman-docker (not trivial, not recommended)
Or manually symlink /usr/local/bin/docker to the real Docker CLI:
bash
sudo mv /usr/bin/docker /usr/bin/docker.podman-shim
sudo ln -s $HOME/.docker/cli-plugins/docker-compose /usr/local/bin/docker-compose # Not quite right, example only
But this gets messy and brittle. Better to pick one tool or the other.
Want me to give you a one-line cleanup script to paste? Just say the word 😄
✅ Solution 2: Run Docker with sudo (Quick but Less Secure)
If you just want a quick test or don’t want to mess with groups:
bash
sudo docker compose -f docker-compose.pprd.yml up -d
⚠️ But this is not recommended for regular use because it's less secure and can cause permission issues with mounted volumes, etc.
✅ Solution 3: Check Docker Daemon Status
Make sure the Docker service is actually running:
bash
sudo systemctl status docker
If it’s not running, start it:
bash
sudo systemctl start docker
Enable it to start on boot:
bash
sudo systemctl enable docker
🧪 Bonus Debug Commands
Check Docker socket permissions:
bash
ls -l /var/run/docker.sock
Expected output:
code
srw-rw---- 1 root docker 0 Jun 10 10:00 /var/run/docker.sock
If your user is in the docker group, you'll be able to access it.
✅ Summary
Problem
Fix
version: in compose file is obsolete
Remove it
Permission denied on /var/run/docker.sock
Add user to docker group: sudo usermod -aG docker $USER && newgrp docker
Want to test quickly
Use sudo docker compose ...
Want me to check your docker-compose.pprd.yml file for other potential deprecations or issues? Just paste it here (you can omit sensitive parts like passwords).