Skip to content

cage doesn't recognise cached bind-mount Docker volume setting #104

@dvejmz

Description

@dvejmz

Problem summary

cage can't parse pod YML files with a cached bind-mount Docker volume configuration in them and errors as a result. This makes running cage in macOS a bit difficult, due to the limitations inherent to Docker for Mac which are usually alleviated by using this mount flag.

Given that cage generates docker-compose v2.4 files, which support the cached Docker volume configuration, I was expecting this not to be an issue in cage. To verify this, I opened the docker-compose file cage generated for my service in .cage, manually made the change to the volume config and run docker-compose up directly against it without an issue.

Environment

Docker version

Client: Docker Engine - Community
 Version:           19.03.9
 API version:       1.40
Server: Docker Engine - Community
 Engine:
  Version:          19.03.9
  API version:      1.40 (minimum version 1.12)

docker-compose version

docker-compose version 1.22.0, build f46880f
docker-py version: 3.7.0
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.1g FIPS  21 Apr 2020

cage version

cage 0.3.0-alpha.3

Operating system

Linux 5.6.13-100.fc30.x86_64 #1 SMP Fri May 15 00:36:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Steps to reproduce

Create a pod definition YML as follows

version: "2"

services:
  my_service:
    build: "./path/to/service/Dockerfile"
    image: "app/my-service:latest"
    entrypoint: bash -c "yarn && yarn start"
    ports:
      - 5000:3000
    volumes:
      - ./path/to/service/app:/app:cached
      - /app/node_modules/

Run any cage command like cage up my-service or cage status.

Actual behaviour

I run any cage command and get the following error back:

Error: could not read '/home/user/dev/project/pods/my-service.yml'
error reading file "/home/user/dev/project/pods/my-service.yml"
services.my_service.volumes: invalid volume permissions "cached" at line 11 column 7

Expected behaviour

Error not to appear and more importantly, cage up my-service to successfully stand up the pod with the volume cached as requested.

Any help with this would be greatly appreciated. I'm happy to submit a PR for this if people think it's a feasible thing to do and it's not overly difficult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions