Skip to content

Can't mount Compose config at a path that doesn't exist in container #232

@psviderski

Description

@psviderski

The deployment of the following compose file:

services:
  grafana:
    image: grafana/grafana:12.2.0
    configs:
      - source: grafana-dashboard-victoriametrics
        target: /var/lib/grafana/dashboards/victoriametrics.json
    volumes:
      - grafanadata:/var/lib/grafana

configs:
  grafana-dashboard-victoriametrics:
    file: ./grafana/dashboards/victoriametrics.json

volumes:
  grafanadata:

fails with the following error:

Error: deploy services: create container: rpc error: code = Internal desc = inject configs: copy config file 'grafana-dashboard-victoriametrics' to container: copy to container: Error response from daemon: Could not find the file /var/lib/grafana/dashboards in container a9a6b7eeda4dbd8a6ea1f43bb66b2cba085d7c0fa2c9a71fb21f4d86a3a917b7

/var/lib/grafana/dashboards/ directory doesn't exist in the container when we mount a new empty volume at /var/lib/grafana. However, docker compose up successfully runs the following compose file and mounts the config as expected.

We need to compare the implementation details of copying configs to created containers in uncloud and docker compose and make it work in uncloud in a similar way.
I don't know the details off the top of my head, but I suspect that we might want the target for the docker CopyToContainer call to always be the root "/". And then create the full file paths that start from the container root in the tar archive. This way unarchiving such a tar will result in creating all intermediate directories that weren't originally present.

cc @tonyo

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions