0

I'm trying to implement Edge containers from Google Cloud vision to My windows machine, and no I' m stuck in running a Docker in command line to serve Edge model inferences with REST APIs :

C:\Users\User-Name\AppData\Local\Google\Cloud SDK>docker run --rm --name 
automl_high_accuracy_model_cpu -p 8501:8501 -v gs://first-edge-253208 
vcm/models/edge/ICN1840948916028989885/2019-09-26_08-53-35-399_tf-saved- 
model:/mounted_model/0001 -t gcr.io/automl-vision-ondevice/gcloud-container-1.12.0:latest

docker: Error response from daemon: invalid volume specification: 'gs://first-edge-253208-vcm/models/edge/ICN1840948916028989885/2019-09-26_08-53-35-399_tf-saved-model:/mounted_model/0001'. See 'docker run --help'.

Bill P
  • 3,622
  • 10
  • 20
  • 32

1 Answers1

0

The reason for this error is because your trying to mount a volume with GCS inside /mounted_model/0001, Docker can't read from a gs path.

Before proceeding you need to download the model at your local disk

gs cp gs://<bucket_model>/<path>/ .

Then run docker and use the full path model (point to the directory where your model is located)

docker run --rm --name 
automl_high_accuracy_model_cpu -p 8501:8501 -v <full_local_path_to_model>:/mounted_model/0001 -t gcr.io/automl-vision-ondevice/gcloud-container-1.12.0:latest

Also You can create a new image, using gcr.io/automl-vision-ondevice/gcloud-container-1.12.0:latest as the base, this could help you to mount it easily inside a VM or Kubernetes.

Create a Dockerfile at the same level where you have your file model (.pb) is located

FROM gcr.io/automl-vision-ondevice/gcloud-container-1.12.0:latest
RUN mkdir -p /tmp/mounted_model/0001/
COPY . /tmp/mounted_model/0001/

And then, build the image

sudo docker build . -t <image_name>

After running your container, you should see this in the logs

I tensorflow_serving/model_servers/server.cc:339] Exporting HTTP/REST API at:localhost:8501 ...
ebeltran
  • 459
  • 2
  • 6
  • Thank you for your Answer, Im using Windows 10, not Linux, I still having the same error : docker: Error response from daemon: invalid volume specification: 'C:\Users\User-Name\AppData\Local\Google\Cloud SDK:\Users\User-Name\AppDat \Local\Google\Cloud SDK\Trained_Mode \ICN1840948916028989885\2019-09-26_08-53-35-399_tf-saved-model:/mounted_model/0001'. See 'docker run --help'. – Marouane SALHAOUI Oct 04 '19 at 08:24
  • Are you using this path to indicate your model location? C:\Users\User-Name\AppDat\Local\Google\Cloud SDK\Trained_Mode\ICN1840948916028989885\2019-09-26_08-53-35-399_tf-saved-model – ebeltran Oct 04 '19 at 14:13
  • Yes, I used this this Path : this is the command : docker run --rm --name automl_high_accuracy_model_cpu -p 8501:8501 -v "%cd%:\Users\User-Name\AppDat \Local\Google\Cloud SDK\Trained_Mode \ICN1840948916028989885\2019-09-26_08-53-35-399_tf-saved-model":/mounted_model/0001 -t gcr.io/automl-vision-ondevice/gcloud-container-1.12.0:latest – Marouane SALHAOUI Oct 04 '19 at 14:47
  • I have found a similar issue for mounting volumes on docker with windows, this can be useful https://stackoverflow.com/questions/35315996/how-do-i-mount-a-docker-volume-while-using-a-windows-host – ebeltran Oct 04 '19 at 14:59