參考:
https://blog.csdn.net/u011734144/article/details/82107610
docker pull tensorflow/serving
$cd /root/software/
$git clone https://github.com/tensorflow/serving
docker run -p 8501:8501
–mount type=bind,\source=${pwd}/serving/tensorflow_serving/servables/tensorflow/testdata/saved_model_half_plus_two_cpu,
target=/models/half_plus_two
-e MODEL_NAME=half_plus_two -t tensorflow/serving &
bind,\source 一定不要出現空格
–mount: 表示要進行掛載
source: 指定要運行部署的模型地址, 也就是掛載的源,這個是在宿主機上的模型目錄
target: 這個是要掛載的目標位置,也就是掛載到docker容器中的哪個位置,這是docker容器中的目錄
-t: 指定的是掛載到哪個容器
-p: 指定主機到docker容器的端口映射
docker run: 啓動這個容器並啓動模型服務(這裏是如何同時啓動容器中的模型服務的還不太清楚)
$curl -d ‘{“instances”: [1.0, 2.0, 5.0]}’
-X POST
驗證
http://localhost:8501/v1/models/half_plus_two:predict
結果
{ “predictions”: [2.5, 3.0, 4.5] }
出現權限問題
setenforce 0 設置寬容模式