<p>I am trying to create a deployment out of my kompose file, but whenever I try: </p>

<pre><code>kompose convert -f docker-compose.yaml
</code></pre>

<p>I get the error: </p>

<pre><code>Volume mount on the host "[file directory]" isn't supported - ignoring path on the host
</code></pre>

<p>I have tried a few different solutions to my issue, firstly trying to add <code>hostPath</code> to my <code>kompose convert</code> as well as using persistent volumes, however both do not work.</p>

<p>my kompose files looks like this: </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert -f docker-compose.yaml --volumes emptyDir
    kompose.version: 1.7.0 (HEAD)
  creationTimestamp: null
  labels:
    io.kompose.service: es01
  name: es01
spec:
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: es01
    spec:
      containers:
      - env:
        - name: COMPOSE_CONVERT_WINDOWS_PATHS
          value: "1"
        - name: COMPOSE_PROJECT_NAME
          value: elastic_search_container
        - name: ES_JAVA_OPTS
          value: -Xms7g -Xmx7g
        - name: discovery.type
          value: single-node
        - name: node.name
          value: es01
        image: docker.elastic.co/elasticsearch/elasticsearch:7.2.1
        name: es01
        ports:
        - containerPort: 9200
        resources: {}
        volumeMounts:
        - mountPath: /usr/share/elasticsearch/data
          name: es01-empty0
      restartPolicy: Always
      volumes:
      - emptyDir: {}
        name: es01-empty0
status: {}
</code></pre>

<p>I am using kompose version 1.7.0 </p>

<p>My Docker Compose version: </p>

<pre><code>version: '3'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.2.1
    container_name: es01
    environment:
      - node.name=es01
      - COMPOSE_PROJECT_NAME=elastic_search_container
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms7g -Xmx7g"
      - COMPOSE_CONVERT_WINDOWS_PATHS=1
    ulimits:
      nproc: 3000
      nofile: 65536
      memlock: -1
    volumes:
      - /home/centos/Sprint0Demo/Servers/elasticsearch:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - kafka_demo
</code></pre>

James Ukilin
<p>You need to take a look on warning you get: </p>

<pre><code>Volume mount on the host "[file directory]" isn't supported - ignoring path on the host
</code></pre>

<p>It happens when volume in <code>docker-compose.yaml</code> is configured with direct path. </p>

<p>Example below:  </p>

<pre><code>version: '3'
services:
  web:
    build: .
    ports:
      - "5000:5000"
    volumes:
      - "./storage1:/test1"
      - "./storage2:/test2"
  redis:
    image: "redis:alpine"
volumes:
  storage1:
  storage2:

</code></pre>

<h3>Persistent Volume Claim</h3>

<p>Take a look on this link: <a href="https://kompose.io/conversion/" rel="nofollow noreferrer">Conversion matrix</a>. 
It describes how <code>kompose</code> converts Docker's volumes to Kubernetes ones. </p>

<p>Executing the conversion command without <code>--volumes</code> parameter:</p>

<p><code>$ kompose convert -f docker-compose.yml</code> </p>

<p>With <code>kompose</code> 1.19 output will yield: </p>

<pre class="lang-sh prettyprint-override"><code>WARN Volume mount on the host "SOME_PATH" isn't supported - ignoring path on the host 
WARN Volume mount on the host "SOME_PATH" isn't supported - ignoring path on the host 
INFO Kubernetes file "web-service.yaml" created   
INFO Kubernetes file "redis-deployment.yaml" created 
INFO Kubernetes file "web-deployment.yaml" created 
INFO Kubernetes file "web-claim0-persistentvolumeclaim.yaml" created 
INFO Kubernetes file "web-claim1-persistentvolumeclaim.yaml" created
</code></pre>

<p>Warning message means that you are explicitly telling <code>docker-compose</code> to create volumes with direct path. By default <code>kompose</code> will convert Docker's volume to <a href="https://kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim" rel="nofollow noreferrer">Persistent Volume Claim</a>.</p>

<h3>emptyDir</h3>

<p>Executing the conversion command with <code>--volumes emptyDir</code> parameter:</p>

<p><code>$ kompose convert -f docker-compose.yml --volumes emptyDir</code> </p>

<p>Will yield effect: </p>

<pre class="lang-sh prettyprint-override"><code>WARN Volume mount on the host "SOME_PATH" isn't supported - ignoring path on the host 
WARN Volume mount on the host "SOME_PATH" isn't supported - ignoring path on the host 
INFO Kubernetes file "web-service.yaml" created   
INFO Kubernetes file "redis-deployment.yaml" created 
INFO Kubernetes file "web-deployment.yaml" created 
</code></pre>

<p><code>kompose</code> will create <a href="https://kubernetes.io/docs/concepts/storage/volumes/#emptydir" rel="nofollow noreferrer">emptyDir</a> declaration inside web-deployment.yaml instead of creating separate definitions of PVC as it has in default. </p>

<h3>hostPath</h3>

<p>Executing the conversion command with <code>--volumes hostPath</code> parameter:</p>

<p><code>$ kompose convert -f docker-compose.yml --volumes hostPath</code> </p>

<p>Will yield effect: </p>

<pre><code>INFO Kubernetes file "web-service.yaml" created   
INFO Kubernetes file "redis-deployment.yaml" created 
INFO Kubernetes file "web-deployment.yaml" created 
</code></pre>

<p>As you can see there is no warning about not supported path. There is no warning because it created <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">hostPath</a> explicitly using your own provided paths from <code>docker-compose.yml</code>. </p>

<p>Take a look on <code>web-deployment.yaml</code> volume section:</p>

<pre><code>      volumes:
      - hostPath:
          path: /LOCAL_PATH-/POD_PATH/storage1
        name: web-hostpath0
      - hostPath:
          path: /LOCAL_PATH-/POD_PATH/storage2
        name: web-hostpath1
</code></pre>
