kompose failed to convert docker compose for key-only field

10/22/2019

I have a docker-compose.yml file, which is version 2.3. (I had to change to 2 during first try with kompose). I tried to convert this yaml file into k8s yaml files with this cmd:

kompose convert -f docker-compose.yml -v

It failed with the error:

ERRO Could not parse config for project xxx : Cannot unmarshal '<nil>' to type <nil> into a string value 
FATA composeObject.Parse() failed, Failed to load compose file: Cannot unmarshal '<nil>' to type <nil> into a string value

It's apparent that the errors are related to some missing-value fields in the docker-compose.yml file: e.g.,

build:
  context: .
  args:
    http_proxy:
    https_proxy:
    no_proxy:
    socks_proxy:
    TF_ANNOTATION: "no"

I searched online and found a related github issue, which seems to have been fixed Issue388. (But no). So I'm wondering how to handle the key-only fields during conversion.

My kompose is shipped with the docker desktop on Mac. Kompose version: 1.19.0 Docker:

  • Engine: 19.03.2
  • Compose: 1.24.1 kubernetes: 1.14.6
-- Jaylin
docker-compose
kompose
kubernetes

1 Answer

10/23/2019

Changing the version from 2 to 3 in docker-compose.yml works for the conversion.

-- Jaylin
Source: StackOverflow