Search code examples
dockergoogle-cloud-automl

docker: Error response from daemon: invalid volume specification


I'm currently following this tutorial to run a model on Docker that was built using the Google Cloud AutoML Vision:

https://cloud.google.com/vision/automl/docs/containers-gcs-tutorial

I'm having trouble running the container, specifically running this command:

sudo docker run --rm --name ${CONTAINER_NAME} -p ${PORT}:8501 -v ${YOUR_MODEL_PATH}:/tmp/mounted_model/0001 -t ${CPU_DOCKER_GCR_PATH}

I have my environment variables set up right (did an echo $<env_var>). I do not have a /tmp/mounted_model/0001 directory on my local system. My model path is configured to be the model location on the cloud storage.


Solution

  • ${YOUR_MODEL_PATH} must be a directory on the host on which you're running the container.

    Your question suggests that you're using the Cloud Storage bucket path but you cannot do this.

    Reviewing the tutorial, I think the instructions are confusing.

    You are told to:

    gsutil cp \
      ${YOUR_MODEL_PATH} \
      ${YOUR_LOCAL_MODEL_PATH}/saved_model.pb
    

    So, your command should probably be:

    sudo docker run \
      --rm \
      --interactive --tty \
      --name=${CONTAINER_NAME} \
      --publish=${PORT}:8501 \
      --volume=${YOUR_LOCAL_MODEL_PATH}:/tmp/mounted_model/0001 \
      ${CPU_DOCKER_GCR_PATH}
    

    NB I added --interactive --tty to make debugging easier; it's optional

    NB ${YOUR_LOCAL_MODEL_PATH} not ${YOUR_MODEL_PATH}

    NB The command should not be -t ${CPU_DOCKER_GCR_PATH} omit the -t

    I've not run through this tutorial.