繁体   English   中英

如何从命令创建 dockerfile 和 docker-compose.yml?

[英]How do I create a dockerfile and docker-compose.yml from the commands?

我有个问题。 我有以下命令。

docker pull tensorflow/serving

docker run -it -v \folder\model:/model-p 8601:8601 --entrypoint /bin/bash tensorflow/serving

tensorflow_model_server --rest_api_port=8601 --model_name=model --model_base_path=/model/

我想将这些添加到dockerfile和 docker docker-compose .yml。 问题是models位于以下文件夹结构下。 所以我将不得不返回一个文件夹并进入另一个文件夹。 我究竟如何使这一切正常工作?

文件夹结构

folder
├── model # should be copied to \model
│     └── 1
│         └── ...
│     └── 2
│         └── ...
├── server
│     └── Dockerfile
│     └── docker-compose.yml
FROM tensorflow/serving
services:
  tfserving:
    container_name: tfserving
    image: tensorflow/serving
    ports:
      - "8601:8601"
    volumes:
      - \folder\model

Dockerfile(用大写的 D 命名它,以便 docker-compose 用 . (点)识别它,因为它在同一个文件夹中):

FROM tensorflow/serving
EXPOSE 8601
RUN tensorflow_model_server --rest_api_port=8601 --model_name=model --model_base_path=/model/

码头工人-compose.yml:

version: '3'

services:
  tfserving:
    container_name: tfserving
    build: .
    ports:
      - "8601:8601"
    volumes:
      - ../model:/models/model
    environment:
      - TENSORFLOW_SERVING_MODEL_NAME=model
    entrypoint: [ "bash", "-c", "tensorflow_model_server --rest_api_port=8601 --model_name=model --model_base_path=/models/model/"]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM