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

feat: directory mounting supports bind and volume modes #115

Closed
wants to merge 6 commits into from

Conversation

DDSDerek
Copy link

@DDSDerek DDSDerek commented Jul 9, 2024

In the old code, using Config.Volumes and HostConfig.Binds to get volume can only display volume mounts in bind mode normally.
I changed it to get the volume through the Mounts data string, so that both bind and volume mounting can be obtained normally.

[
    {
        "Id": "81da5acdde68bc319ebdcf306112ee7b2ba3ad9fd5105a2aeea1bd3d00c042ba",
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/xxxx/data",
                "Destination": "/xxxx/data",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "volume",
                "Name": "31528af375053362a6b7f74650cfc8c39b22808af111581190d8efd30c47aee5",
                "Source": "/xxx/volumes/31528af375053362a6b7f74650cfc8c39b22808af111581190d8efd30c47aee5/_data",
                "Destination": "/xxxx/data",
                "Driver": "local",
                "Mode": "rw",
                "RW": true,
                "Propagation": ""
            }
        ]
    }
]

@lavie
Copy link
Owner

lavie commented Jul 9, 2024

Cool! Would you kindly add test coverage for this change?

@DDSDerek
Copy link
Author

DDSDerek commented Jul 9, 2024

Cool! Would you kindly add test coverage for this change?

FAILED test_runlike.py::TestRunlike::test_network_mode - AssertionError: '--n...
FAILED test_runlike.py::TestRunlike::test_restart_not_present - AssertionErro...

There are currently two errors in the part, but I haven't made any changes, so I can't solve it. Can you help me to solve it?

@DDSDerek
Copy link
Author

DDSDerek commented Jul 9, 2024

@lavie I have solved these two problems here. In the latest docker:

  • If the restart policy is not set, the default value is no.
  • When no network mode is set, bridge is used by default

@DDSDerek
Copy link
Author

DDSDerek commented Jul 9, 2024

@lavie Now the test should pass perfectly.

test_runlike.py Show resolved Hide resolved
test_runlike.py Outdated Show resolved Hide resolved
test_runlike.py Outdated Show resolved Hide resolved
@DDSDerek DDSDerek requested a review from lavie July 9, 2024 08:09
@lavie
Copy link
Owner

lavie commented Sep 10, 2024

continued in #121

@lavie lavie closed this Sep 10, 2024
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

Successfully merging this pull request may close these issues.

3 participants