<p>i am trying to migrate a docrized project to kubernetes, i have used Kompose to convert the project </p>

<p><code>kompose --file docker-compose.yml convert</code>, </p>

<p>when i run <code>kompose up</code> after migrating the files 
i get this error </p>

<p><code>$ kompose up
WARN Unsupported env_file key - ignoring<br>
FATA Error while deploying application: k.Transform failed: image key required within build parameters in order to build and push service 'drkiq'
</code></p>

<p>.env file:</p>

<p><code>SECRET_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
WORKER_PROCESSES=1
LISTEN_ON=0.0.0.0:8000
DATABASE_URL=postgresql://drkiq:yourpassword@postgres:5432/drkiq?encoding=utf8&amp;pool=5&amp;timeout=5000
CACHE_URL=redis://redis:6379/0
JOB_WORKER_URL=redis://redis:6379/0
</code></p>

<p>Dockerized project Link <a href="https://semaphoreci.com/community/tutorials/dockerizing-a-ruby-on-rails-application" rel="nofollow noreferrer" title="this text appears when you mouse over">here</a>!</p>

<p>any idea how to convert the .env file to a format that can be used with kubernetes kompose</p>

<p>Docker-compose file:</p>

<pre><code>  postgres:
    image: postgres:9.4.5
    environment:
      POSTGRES_USER: drkiq
      POSTGRES_PASSWORD: yourpassword
    ports:
      - '5432:5432'
    volumes:
      - drkiq-postgres:/var/lib/postgresql/data

  redis:
    image: redis:3.0.5
    ports:
      - '6379:6379'
    volumes:
      - drkiq-redis:/var/lib/redis/data

  drkiq:
    build: .
    links:
      - postgres
      - redis
    volumes:
      - .:/drkiq
    ports:
      - '8000:8000'
    env_file:
      - .drkiq.env
  sidekiq:
    build: .
    command: bundle exec sidekiq -C config/sidekiq.yml
    links:
      - postgres
      - redis
    volumes:
      - .:/drkiq
    env_file:
      - .drkiq.env
</code></pre>

zewOlF
<p>Kubernetes kompose supports <code>env_file</code> conversion from <a href="https://docs.docker.com/compose/compose-file/" rel="nofollow noreferrer">Docker Compose 3.x</a> version as it's described in <a href="https://github.com/kubernetes/kompose/blob/master/docs/conversion.md" rel="nofollow noreferrer">Conversion matrix</a>.</p>

<p>In Kubernetes you can use <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/" rel="nofollow noreferrer">ConfigMap</a> to store your environment variables from <code>env_file</code>. For <code>SECRET_TOKEN</code> variable, you can use <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">Secrets</a> to hold your private and sensitive data.</p>

<p>You can also check other tools for conversion purpose like <a href="https://github.com/kelseyhightower/compose2kube" rel="nofollow noreferrer">compose2kube</a> or <a href="https://github.com/dhoer/k8s-env-gen" rel="nofollow noreferrer">k8s-env-gen</a>.</p>

<p>According to the attached <code>Docker-composer</code> file and the error during the conversion process, I can assume that you missed image key value for <code>drkiq</code> and <code>sidekiq</code> services:</p>

<p><strong>Update:</strong> docker-compose.yml file</p>

<pre><code>version: '2'

services:
  postgres:
    image: postgres:9.4.5
    environment:
      POSTGRES_USER: drkiq
      POSTGRES_PASSWORD: yourpassword
    ports:
      - '5432:5432'
    volumes:
      - drkiq-postgres:/var/lib/postgresql/data

  redis:
    image: redis:3.0.5
    ports:
      - '6379:6379'
    volumes:
      - drkiq-redis:/var/lib/redis/data

  drkiq:
    build: .
    image: drkiq:tag
    links:
      - postgres
      - redis
    volumes:
      - .:/drkiq
    ports:
      - '8000:8000'
    env_file:
      - .drkiq.env
  sidekiq:
    build: .
    command: bundle exec sidekiq -C config/sidekiq.yml
    image: sidekiq:tag
    links:
      - postgres
      - redis
    volumes:
      - .:/drkiq
    env_file:
      - .drkiq.env
</code></pre>
