Skip to content

Handle docker-compose files containing mounted files  #587

Description

@chriswalker

Short issue description

docker-compose files containing file mounts generate warnings when running kev render to generate the k8s manifests. For example, the following compose file is valid and attempts to mount a local prometheus.yml configuration file within the container:

version: '2'
volumes:
  prometheus_data: {}
services:
  prometheus:
    image: prom/prometheus
    volumes:
      - prometheus_data:/prometheus
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    ports:
      - '9090:9090'

This is fine for docker-compose, but does not translate directly to Kubernetes, hence the warnings when running kev render, leading to the following output:

⠋ Converting service: prometheus warn  Volume mount on the host isn't supported. Ignoring path on the host host=/path/to/config/prometheus.yml project-service=prometheus

Kev version:
OS (Linux/Mac/Windows..): MacOS Bug Sur (11.4)
Docker Compose version: 1.29.2
Kubernetes version: 1.21.1
Kubernetes distribution (e.g. GKE, EKS, ...): as bundled with Docker Desktop

How can we reproduce the issue?

Using the above docker-compose.yaml sample, run kev init ..., followed by kev render.

Suggestions on how to fix the issue (OPTIONAL)

There are a couple of scenarios to consider here. Users may be mounting text files (usually config files, as in the example above), or less common files types such as sockets (mounting the docker socket isn't uncommon). kev could display more helpful information around translating configuration-type files into Kubernetes ConfigMaps, and sensibly error when dealing with files such as Unix sockets.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions