Skip to content

Environment value merge failed with multiple docker-compose files #972

Closed
@neeon-li

Description

This may relate to Issue #968.

Environment value is unable to merge and replaced by the last docker-compose file.
Merge with command kompose convert -o dev-out.yaml -f base.yaml -f dev.yaml

base.yaml

version: '3'

services:
  web:
    image: richarvey/nginx-php-fpm
    environment:
      - ERRORS=0
      - HIDE_NGINX_HEADERS=0
      - REMOVE_FILES=0
      - RUN_SCRIPTS=0
      - PHP_ERRORS_STDERR=0
      - ENABLE_XDEBUG=0

dev.yaml

version: '3'

services:
  web:
    environment:
      - ERRORS=1
      - HIDE_NGINX_HEADERS=0
      - REMOVE_FILES=0
      - RUN_SCRIPTS=1
      - PHP_ERRORS_STDERR=1
      - ENABLE_XDEBUG=1

But the dev-out.yaml shows

apiVersion: v1
items:
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      kompose.cmd: kompose convert -o dev-out.yaml -f base.yaml -f dev.yaml
      kompose.version: 1.11.0 ()
    creationTimestamp: null
    labels:
      io.kompose.service: web
    name: web
  spec:
    clusterIP: None
    ports:
    - name: headless
      port: 55555
      targetPort: 0
    selector:
      io.kompose.service: web
  status:
    loadBalancer: {}
- apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    annotations:
      kompose.cmd: kompose convert -o dev-out.yaml -f base.yaml -f dev.yaml
      kompose.version: 1.11.0 ()
    creationTimestamp: null
    labels:
      io.kompose.service: web
    name: web
  spec:
    replicas: 1
    strategy: {}
    template:
      metadata:
        creationTimestamp: null
        labels:
          io.kompose.service: web
      spec:
        containers:
        - env:
          - name: ENABLE_XDEBUG
            value: "0"
          - name: ERRORS
            value: "0"
          - name: HIDE_NGINX_HEADERS
            value: "0"
          - name: PHP_ERRORS_STDERR
            value: "0"
          - name: REMOVE_FILES
            value: "0"
          - name: RUN_SCRIPTS
            value: "0"
          image: richarvey/nginx-php-fpm
          name: web
          resources: {}
        restartPolicy: Always
  status: {}
kind: List
metadata: {}

The environment value of the container is unable to replace by the dev.yaml.

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