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

Binding volume to specific host path doesn't work #3316

Open
abbaahmad opened this issue Mar 2, 2025 · 0 comments
Open

Binding volume to specific host path doesn't work #3316

abbaahmad opened this issue Mar 2, 2025 · 0 comments

Comments

@abbaahmad
Copy link

I'm attempting to create a container with volume in some host path /home/ubuntu/data bound to a container path /mnt/data, but the volume is instead created and bound to var/lib/docker/vfs/<some-hash>/home/ubuntu/data. Is there something I might be missing here? Here is the related code-snippet

   _ = docker.containers.run(
        image=image.id,
        command=f"{args}",
        name=c.DOCKER_IMAGE_NAME,
        restart_policy={"Name": "always"},
        volumes={f"{c.DATADIR_PATH.as_posix()}": {"bind": "/mnt/data", "mode": "rw"}},
        ports={"5432": ("0.0.0.0", 5432), "5433": ("0.0.0.0", 5433)},
        detach=True,
    )

DATADIR_PATH=/home/ubuntu/data. One thing to note is DATADIR_PATH of of type Path from pathlib module

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

No branches or pull requests

1 participant