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

Backslashes used on destination volume mounts overrides #215

Open
ttk opened this issue Oct 1, 2024 · 2 comments
Open

Backslashes used on destination volume mounts overrides #215

ttk opened this issue Oct 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ttk
Copy link

ttk commented Oct 1, 2024

When an volume override is added in the lando config file, and that specific volume contains an addition option such as ro, cached, then lando will use back slashes in the destination path instead of the expected forward slashes (unix style). I assume this problem is Windows specific issue.

Here is a simple example:

name: test

services:
  testnginx:
    type: nginx
    overrides:
      volumes:
        - ./dir1:/app/dir1
        - ./dir2:/app/dir2:ro,cached

When inspecting the raw docker compose file generated by lando in %USERPROFILE%\.lando\compose\test I see this:

services:
  testnginx:
    volumes:
      - 'C:\tmp\landotest\dir1:/app/dir1'
      - 'C:\tmp\landotest\dir2:\app\dir2:ro,cached'

Notice that /app/dir1 bind mount is correct (using forward slashes), but the second \app\dir2:ro,cached is using back slashes.

It seems like docker itself doesn't mind this at all...the source directory is binded to the container's destination directory just fine.

However, a problem arises when trying to override and existing volume mount. For example, if lando by default adds a volume: .:/app and I wanted to override it to make it readonly .:/app:ro,cached, then lando doesn't override the existing volume specification because it thinks they are different /app is not equal to \app and we end up with two mounts to the same destination directory. So the override functionality is broken in this case.


$ lando version
v3.21.2
@ttk ttk added the bug Something isn't working label Oct 1, 2024
@reynoldsalec
Copy link
Member

Possible this is something unique to some string interpretation within Lando on Windows? @AaronFeledy don't know if you'd have any insight on that, with your deep connection to the Redmond life force.

@ttk
Copy link
Author

ttk commented Oct 1, 2024

I found a workaround for this issue, by using the long syntax instead of the short syntax for the volume whenever an access mode is required.

Here is my example converted to the long syntax. I can confirm that I can properly override existing mount points using this method.

name: test

services:
  testnginx:
    type: nginx
    overrides:
      volumes:
        - ./dir1:/app/dir1
        - type: bind
          source: ./dir2
          target: /app/dir2
          read_only: true

So the bug is specific to the short syntax (on Windows), when an ACCESS_MODE is specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants