Error: Error response from daemon: invalid volume specification - Windows 8.1 Docker Toolbox

6/6/2019

Error: Error response from daemon: invalid volume specification: 'C:/Users/Anthony/magento2-devbox:/C:/Users/Anthony/magento2-devbox'

I have had a google around on this but I cant see how this path has been assembled. Most paths exclude the : and i am also not sure why it has assembled this :/C:/ or whether this is just produced for the error message.

This is the YAML for the replica set;

{
  "kind": "ReplicaSet",
  "apiVersion": "extensions/v1beta1",
  "metadata": {
    "name": "magento2-monolith-54cdd5b4b7",
    "namespace": "default",
    "selfLink": "/apis/extensions/v1beta1/namespaces/default/replicasets/magento2-monolith-54cdd5b4b7",
    "uid": "e819bfbd-8820-11e9-a613-080027316036",
    "resourceVersion": "22855",
    "generation": 1,
    "creationTimestamp": "2019-06-06T06:04:12Z",
    "labels": {
      "app.kubernetes.io/instance": "magento2",
      "app.kubernetes.io/name": "monolith",
      "pod-template-hash": "54cdd5b4b7"
    },
    "annotations": {
      "deployment.kubernetes.io/desired-replicas": "1",
      "deployment.kubernetes.io/max-replicas": "1",
      "deployment.kubernetes.io/revision": "1"
    },
    "ownerReferences": [
      {
        "apiVersion": "apps/v1",
        "kind": "Deployment",
        "name": "magento2-monolith",
        "uid": "9ec9d23e-8691-11e9-a3dd-080027316036",
        "controller": true,
        "blockOwnerDeletion": true
      }
    ]
  },
  "spec": {
    "replicas": 1,
    "selector": {
      "matchLabels": {
        "app.kubernetes.io/instance": "magento2",
        "app.kubernetes.io/name": "monolith",
        "pod-template-hash": "54cdd5b4b7"
      }
    },
    "template": {
      "metadata": {
        "creationTimestamp": null,
        "labels": {
          "app.kubernetes.io/instance": "magento2",
          "app.kubernetes.io/name": "monolith",
          "pod-template-hash": "54cdd5b4b7"
        }
      },
      "spec": {
        "volumes": [
          {
            "name": "nginx-config-volume",
            "configMap": {
              "name": "magento2-monolith-nginx-config",
              "defaultMode": 420
            }
          },
          {
            "name": "varnish-config-volume",
            "configMap": {
              "name": "magento2-monolith-varnish-config",
              "defaultMode": 420
            }
          },
          {
            "name": "code",
            "hostPath": {
              "path": "C:/Users/Anthony/magento2-devbox",
              "type": ""
            }
          }
        ],
        "containers": [
          {
            "name": "monolith",
            "image": "magento2-monolith:dev",
            "ports": [
              {
                "containerPort": 8050,
                "protocol": "TCP"
              }
            ],
            "env": [
              {
                "name": "DEVBOX_ROOT",
                "value": "C:/Users/Anthony/magento2-devbox"
              },
              {
                "name": "COMPOSER_HOME",
                "value": "C:/Users/Anthony/magento2-devbox/.composer"
              },
              {
                "name": "MAGENTO_ROOT",
                "value": "C:/Users/Anthony/magento2-devbox/magento"
              },
              {
                "name": "MAGENTO_ROOT_HOST",
                "value": "C:/Users/Anthony/magento2-devbox/magento"
              },
              {
                "name": "DEVBOX_ROOT_HOST",
                "value": "C:/Users/Anthony/magento2-devbox"
              },
              {
                "name": "IS_WINDOWS_HOST",
                "value": "0"
              }
            ],
            "resources": {},
            "volumeMounts": [
              {
                "name": "code",
                "mountPath": "C:/Users/Anthony/magento2-devbox"
              }
            ],
            "terminationMessagePath": "/dev/termination-log",
            "terminationMessagePolicy": "File",
            "imagePullPolicy": "Never",
            "securityContext": {
              "privileged": true,
              "procMount": "Default"
            }
          },
          {
            "name": "monolith-xdebug",
            "image": "magento2-monolith:dev-xdebug",
            "ports": [
              {
                "containerPort": 8002,
                "protocol": "TCP"
              }
            ],
            "env": [
              {
                "name": "DEVBOX_ROOT",
                "value": "C:/Users/Anthony/magento2-devbox"
              },
              {
                "name": "COMPOSER_HOME",
                "value": "C:/Users/Anthony/magento2-devbox/.composer"
              },
              {
                "name": "MAGENTO_ROOT",
                "value": "C:/Users/Anthony/magento2-devbox/magento"
              },
              {
                "name": "MAGENTO_ROOT_HOST",
                "value": "C:/Users/Anthony/magento2-devbox/magento"
              },
              {
                "name": "DEVBOX_ROOT_HOST",
                "value": "C:/Users/Anthony/magento2-devbox"
              },
              {
                "name": "IS_WINDOWS_HOST",
                "value": "0"
              }
            ],
            "resources": {},
            "volumeMounts": [
              {
                "name": "code",
                "mountPath": "C:/Users/Anthony/magento2-devbox"
              }
            ],
            "terminationMessagePath": "/dev/termination-log",
            "terminationMessagePolicy": "File",
            "imagePullPolicy": "Never",
            "securityContext": {
              "privileged": true,
              "procMount": "Default"
            }
          },
          {
            "name": "nginx",
            "image": "nginx:1.9",
            "resources": {},
            "volumeMounts": [
              {
                "name": "code",
                "mountPath": "C:/Users/Anthony/magento2-devbox"
              },
              {
                "name": "nginx-config-volume",
                "mountPath": "/etc/nginx/nginx.conf",
                "subPath": "nginx.conf"
              }
            ],
            "terminationMessagePath": "/dev/termination-log",
            "terminationMessagePolicy": "File",
            "imagePullPolicy": "IfNotPresent",
            "securityContext": {
              "privileged": true,
              "procMount": "Default"
            }
          },
          {
            "name": "varnish",
            "image": "million12/varnish",
            "env": [
              {
                "name": "VCL_CONFIG",
                "value": "/etc/varnish/magento.vcl"
              },
              {
                "name": "VARNISHD_PARAMS",
                "value": "-a 0.0.0.0:6081"
              }
            ],
            "resources": {},
            "volumeMounts": [
              {
                "name": "varnish-config-volume",
                "mountPath": "/etc/varnish/magento.vcl",
                "subPath": "varnish.vcl"
              }
            ],
            "terminationMessagePath": "/dev/termination-log",
            "terminationMessagePolicy": "File",
            "imagePullPolicy": "Always"
          }
        ],
        "restartPolicy": "Always",
        "terminationGracePeriodSeconds": 30,
        "dnsPolicy": "ClusterFirst",
        "securityContext": {},
        "schedulerName": "default-scheduler"
      }
    }
  },
  "status": {
    "replicas": 1,
    "fullyLabeledReplicas": 1,
    "observedGeneration": 1
  }
}

I am new to Docker/Kubernetes after coming over from Vagrant so i do not know where to start. The information i have is from the web browser dashboard

-- Anthony
kubernetes
kubernetes-helm

1 Answer

6/6/2019

Path is probably not converted to unix style. Since docker 1.9.0, Windows paths are not automatically converted (eg. C:\Users to /c/Users).

So your path should be like :

{
   "name": "DEVBOX_ROOT",
   "value": "/c/Users/Anthony/magento2-devbox"
}
-- A_Suh
Source: StackOverflow