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

Allow identical duplicate volumes and mounts #4462

Closed
wants to merge 1 commit into from

Conversation

mheon
Copy link
Member

@mheon mheon commented Nov 6, 2019

Docker allows exactly identical mounts and volumes to be passed without throwing an error. If a volume is exactly identical, we should not error - otherwise, we'll still give a duplicate mount destination error.

Fixes #4217

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M labels Nov 6, 2019
@TomSweeneyRedHat
Copy link
Member

all kinds of test unhappiness @mheon

Docker allows exactly identical mounts and volumes to be passed
without throwing an error. If a volume is exactly identical, we
should not error - otherwise, we'll still give a duplicate mount
destination error.

Fixes containers#4217

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
@rhatdan
Copy link
Member

rhatdan commented Nov 6, 2019

I don't see why we should be bug for bug compatible with Docker. I think this is bad, it allows users to make mistakes in the containers and not notice it.

@rhatdan rhatdan closed this Dec 4, 2019
@1ace
Copy link

1ace commented Oct 15, 2021

@rhatdan:

I don't see why we should be bug for bug compatible with Docker.

Being able to run the images everyone using docker is able to run sounds like something podman should strive for, don't you think? And this isn't about adding a bug, it's about not failing when a bug is present in the image podman is told to run.

I've arrived here because I'm trying to transition my company over to podman, but this is the bug I'm currently stuck on: docker accepts using the official postgres image as is, while podman rejects it and it looks like (unless this PR is merged) my only option is to copy the postgres Dockerfile, remove the duplicate VOLUME line, and have to build it and ship this alongside our app.

Surely you agree merging this PR to be compatible with docker is the more reasonable option, even if it might not be as helpful to users making copy/paste typos as the current fatal error?

I hope you'll reconsider 🙂

@rhatdan
Copy link
Member

rhatdan commented Oct 15, 2021

Do you have an image that causes this behaviour? If this happens because of an image, then we need to fix it. If this happens because someone is sloppy with the command line, then I am less inclined to fix it.

@1ace
Copy link

1ace commented Oct 15, 2021

This docker-compose.yml reproduces the issue:

version: "3.7"

services:
  postgres:
    image: postgres:alpine
    environment:
      PGDATA: /var/lib/postgresql/data/pgdata
      POSTGRES_PASSWORD: random
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:
$ docker compose up
[+] Running 3/1
 ⠿ Network tmp_default         Created                                                                             0.1s
 ⠿ Volume "tmp_postgres_data"  Created                                                                             0.0s
 ⠿ Container tmp-postgres-1    Created                                                                             0.0s
Attaching to tmp-postgres-1
tmp-postgres-1  | The files belonging to this database system will be owned by user "postgres".
tmp-postgres-1  | This user must also own the server process.
[...]
$ export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock"
$ docker compose up
[+] Running 2/0
 ⠿ Network tmp_default         Created                                                                             0.0s
 ⠿ Volume "tmp_postgres_data"  Created                                                                             0.0s
 ⠋ Container tmp-postgres-1    Creating                                                                            0.0s
Error response from daemon: fill out specgen: /var/lib/postgresql/data: duplicate mount destination

@1ace
Copy link

1ace commented Oct 15, 2021

Sorry, I assumed you knew this wasn't just a "duplicate -v in the command line" issue and chose not to fix it.
Apologies if my first message was a bit too strong 🙏

@rhatdan
Copy link
Member

rhatdan commented Oct 15, 2021

Resubmit the PR, I don't seem to be able to reopen it.

@mheon
Copy link
Member Author

mheon commented Oct 15, 2021

Are you running Docker Compose v2.0? There's a known issue with v2.0 against Podman where this is showing up. The fix is almost certainly not the one in the PR, there's something deeper going on there.

@1ace
Copy link

1ace commented Oct 16, 2021

Are you running Docker Compose v2.0?

Yes, I am actually; I'll try docker-compose v1.x when I'm back in the office on Monday. I'll also try to compile podman with this change to see if it helps, I didn't have time to do this on Friday but I'm hoping I'll be able to next week.

There's a known issue with v2.0 against Podman where this is showing up.

Ah, I don't know why I missed #11822 & #11717 when I searched earlier. I've subscribed to these issues now, and providing downgrading docker-compose fixes this problem, I'll stick with that workaround for now.

I'm also happy to help test patches to get v2 compatibility 🙂

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman rejects duplicate mount specifications
5 participants