Skip to content

Instantly share code, notes, and snippets.

@wronk
Created February 13, 2019 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wronk/1fa35478e1127d4aca2f388e366a5c69 to your computer and use it in GitHub Desktop.
Save wronk/1fa35478e1127d4aca2f388e366a5c69 to your computer and use it in GitHub Desktop.
TF Serving blog post: Docker image
######################################
# Pseudocode for creating Docker image
# Get the Docker TF Serving image we'll use as a foundation to build our custom image
docker pull tensorflow/serving
# Start up this TF Docker image as a container named `serving_base`
docker run -d --name serving_base tensorflow/serving
# Copy the Estimator from our local folder to the Docker container
# You can rename `my_model` to best reflect your model's name. It's what will be used in the REST API call
docker cp /path/to/my_exported_models serving_base:/models/<my_model>
# Commit the new Docker container and kill the serving base
docker commit --change "ENV MODEL_NAME <my_model>" serving_base <org_name>/<image_name>:<version_tag>
docker kill serving_base
###################################
# Same example with filled in data:
docker pull tensorflow/serving
docker run -d --name serving_base tensorflow/serving
docker cp models_hvgrid_export serving_base:/models/hv_grid
docker commit --change "ENV MODEL_NAME hv_grid" serving_base developmentseed/hv_grid:v1
docker kill serving_base
docker run -p 8501:8501 -t developmentseed/hv_grid:v1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment