Closed ggpinto closed 2 years ago
Thank you so much for checking out vetiver @ggpinto! There are two issues here, the pins board and EXPOSE
.
The decision to keep the binary model object outside the Docker container is entirely purposeful. The model needs to be versioned and located outside the container, for a more robust and flexible workflow. You are totally free to edit the Dockerfile and do this if it fits your particular use case better, but we consider this an "off label" use. You can see an example here that authenticates a Docker container to a pins board.
I am open to the idea of adding EXPOSE
if it is useful to people, but just to clarify, it is not necessary to build or run the container. The EXPOSE
command does not change anything about how you access the container; it is only useful as documentation and these Dockerfiles already include the port in the text. You can read more here:
I am pretty neutral about adding this if it is useful to folks as documentation (I am never against more clear documentation!) but it will be good to understand that it will not actually expose a port.
Hi @juliasilge, thank you for your incredible work!
I understood the first issue (pins board), thanks for the explanation! I am reading the book Practical MLOps by Noah Gift and Alfredo Deza and trying to implement using R, the book uses python so I got a bit confused there.
About the second issue, I have read the documentation and understood that EXPOSE
will not expose the port. It would be useful for people who run the container using Docker Desktop (at least on Windows). Without EXPOSE
I can't assign a port for the local host (and therefore can't use the API):
With EXPOSE
I can assign a port:
The problem doesn't occur when using docker run
with -p 8000:8000
on the command line.
Thanks again @ggpinto!
Here are a reprex and version that works
This Dockerfile doesn't work because it doesn't expose the port 8000 and assumes that the container has access to the board (see plumber.R)
Created on 2022-06-07 by the reprex package (v2.0.1)
This a Dockerfile that works for me (expose the port and copy the board to the container):