JBGruber/rollama

docker ports are safer on localhost

Closed this issue · 4 comments

Hi,

thanks, this is a very cool package! I do not know how relevant this is, but I recently learned myself, rather painfully, that if you publish docker ports like so: -p 11434:11434 they become available on the whole local network and without a good firewall (ufw on linux does not help) also to the internet, which could be rather unsafe. (see https://docs.docker.com/network/#published-ports for the default bind to 0.0.0.0)

Hence I would recommend changing the readme.md for docker to:
docker run -d -v ollama:/root/.ollama -p 127.0.0.1:11434:11434 --name ollama ollama/ollama

Now the container will be available to localhost only and no ports are opened to other interfaces, like the internet. Which I think is the more expected outcome.

All the best
Paul

I updated the gist for the Docker Compose file. The docker command was now removed from the readme, since the Ollama executable works pretty well on common operating systems and Docker turned out to be a hurdle for some users.

Oh, and: thanks for pointing this out. I assume most people have a firewall in their home router and this should not matter. But it also doesn't hurt to be safe here.

Nice, thanks.
True, on normal routers the firewall should catch this! I still find it odd somtimes that Docker would make the default 0.0.0.0 instead of making the default the safe option 127.0.0.1. I guess it makes sure whatever you want to expose works out of the box, instead of having to think about networking.

Also: on Macs the executable is supporting the metal GPU, which it did not in the docker, so another argument to just use the executable anyways...

Yeah, I was also struggeling to find a nice clean option to work with AMD GPUs from within Docker (I don't have one to test myself, which didn't make it easier). It made sense when we wrote the readme to point to Docker, as Windows wasn't supported and Linux support was experimental. But Ollama has come a long way.