由于某些因素,我们公司弃用了所有Docker系工具,转而全面拥抱Podman,而前几天的React 10.0分大漏洞,也让Dify紧急更新,因而促成了这篇文章。
部署环境:
- Windows 11
- WSL2
- Dify 1.11.1
- Podman Desktop 1.23.1
- Podman 5.7.1
- podman-compose 1.5.0
坑&解决方案:
-
Podman镜像下载慢
我用的是轩辕镜像
podman-machine切换下载源:
wsl -d podman-machine-default sudo vi /etc/containers/registries.conf.d/999-podman-machine.conf文件内容:
unqualified-search-registries=["docker.io"] [[registry]] prefix = "docker.io" insecure = false location = "docker.io" # 使用轩辕镜像作为加速源 [[registry.mirror]] location = "你的专属域名" insecure = true然后Ctrl + D回cmd
podman machine stop podman machine start就好了
-
RuntimeError: missing networks: default
因为Podman需要一个default的网络。
docker-compose.yaml最下面的
networks: # create a network between sandbox, api and ssrf_proxy, and can not access outside. ssrf_proxy_network: driver: bridge internal: true milvus: driver: bridge opensearch-net: driver: bridge internal: true改成
networks: # create a network between sandbox, api and ssrf_proxy, and can not access outside. ssrf_proxy_network: driver: bridge internal: true default: driver: bridge -
KeyError: 'seekdb'或者KeyError: 'db_mysql'或者KeyError: 'oceanbase'或者KeyError: 'db_postgres'
因为podman识别不了required: false这个条件
对于docker-compose.yaml中每一段
db_postgres: condition: service_healthy required: false db_mysql: condition: service_healthy required: false oceanbase: condition: service_healthy required: false seekdb: condition: service_healthy required: false由于我用的是db_postgres,所以删掉其他的以及db_postgres的required: false,留下:
db_postgres: condition: service_healthy -
KeyError: 'db_postgres'这一步是因为上一步删完后,db_postgres没有自动引入,
所以根据docker-compose.yaml中的
profiles: - postgresql我们将命令
podman-compose up -d修改为
podman-compose --profile postgresql up -d -
Error: unable to start container "你的docker_nginx_1容器ID": starting some containers: internal libpod error
这个问题卡我最久,因为nginx秒关且完全没有log输出
查找网上信息或问AI,大多数是围绕着端口号被占用考虑的,也有说cgroup版本不对的,但都不是我的情况
后来经过 “启动纯净Nginx容器成功 -> 在docker-compose中仅保留Nginx成功 -> 在docker-compose中仅删除Nginx成功” 判断出是容器启动顺序或者依赖关系之类的原因,于是删掉了docker-compose.yaml中nginx部分的
depends_on: - api - web后也迎来了我的成功
小小的改动背后是数个日夜的不眠不休,可叹
-
Nginx port相关
把.env和docker-compose.yaml中的所有Nginx相关端口都从80和443改掉
-
chmod: /var/lib/postgresql/data/pgdata: Operation not permitted
访问Dify后报错Internal Server error,这个问题可能有多种成因,我的是,发现是docker_db_postgres_1容器启动失败报错 chmod: /var/lib/postgresql/data/pgdata: Operation not permitted
我的方案是把dify文件夹整个移动到podman-machine-default中,然后通过命令
sudo dnf install podman-compose安装podman-compose,运行就好了
-
runtime error: invalid memory address or nil pointer dereference
我把模型供应商删除再安装就好了