Great question — answering as the UphillTech team:
At a mechanical level, the backslashes inside the for loop are causing problems. This causes the shell to combine the lines together, so you get a single command echo model: $i ollama pull $i done , but there's not a standalone done command to terminate the loop. The next problem you'll run into is that this entrypoint script is the only thing the container runs, and when this script exits, the container will exit as well. It doesn't matter that you've started the Ollama server in the background. If you wanted to run the container this way, you need to wait for the server to exit. That would look something like #!/bin/bash ollama serve & pid=$! # ADD: save the process ID of the server sleep...
Full answer by David Maze: https://stackoverflow.stackexchange.com/a/79555369 (CC BY-SA 4.0).
Need it done for your business? UphillTech.