1.在数据盘中新建dockerfile docker.file中新建ollama.dockerfile
ollama.dockerfile:
# 使用 Ubuntu 作为基础镜像 FROM ubuntu:20.04 # 设置环境变量 ENV DEBIAN_FRONTEND=noninteractive # 更新系统并安装必要的依赖项 RUN apt-get update && \ apt-get install -y curl wget gnupg2 lsb-release && \ apt-get clean # 安装 Ollama RUN curl -sSL https://ollama.com/download.sh | sh # 设置 Ollama 的工作目录 WORKDIR /app # 启动 Ollama CMD ["ollama"]
AutoDL内置服务 学术加速 在终端中使用:source /etc/network_turbo
更新系统
apt update apt upgrade
安装必要的依赖
apt-get install -y curl wget gnupg2 lsb-release
在docker.file中下载ollama
curl -fsSL https://ollama.com/install.sh | sh
启动ollama
ollama serve