AlmaLinux9.6 (Sage Margay)默认yum包用的是podman和podman compose,而Dify官方通的是docker-compose的部署方案,本以为很简单,结果碰到几个小问题记录下:
拉取Dify配置
1
2
3
4
| #拉配置
git clone https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env
|
初遇问题
拉镜像
1
2
| podman compose pull
podman-compose version: 1.0.6 ['podman', '--version', ''] using podman version: 5.4.0 Traceback (most recent call last): File "/usr/bin/podman-compose", line 33, in <module> sys.exit(load_entry_point('podman-compose==1.0.6', 'console_scripts', 'podman-compose')()) File "/usr/lib/python3.9/site-packages/podman_compose.py", line 2940, in main podman_compose.run() File "/usr/lib/python3.9/site-packages/podman_compose.py", line 1420, in run self._parse_compose_file() File "/usr/lib/python3.9/site-packages/podman_compose.py", line 1567, in _parse_compose_file raise RuntimeError(f"missing networks: {missing_nets_str}") RuntimeError: missing networks: default
|
报了网络缺失的问题,初步推断是podman compose的问题,因为podman compose version也报错
重装podman
1
2
3
| yum list installed | grep podman
yum remove podman.x86_64 podman-catatonit.x86_64 podman-docker.noarch podman-plugins.x86_64
yum install podman-compose podman -y
|
podman-compose version
podman没问题了
继续拉镜像
1
2
3
4
5
| podman compose pull
RuntimeError: missing networks: default
#既然提示没有default网络就尝试创建
podman network create default
network create default Error: cannot create network with name "default" because it conflicts with a valid network mode
|
好吧,那看看默认网络是啥
podman network ls
发现podman默认网络名是podman
所以去把docker-compose.yaml所有的
1
2
3
4
5
6
7
| network:
- default
#都改成
network:
- podman
#继续
podman-compose pull podman-compose version: 1.0.6 ['podman', '--version', ''] using podman version: 5.4.0 Traceback (most recent call last): File "/usr/bin/podman-compose", line 33, in <module> sys.exit(load_entry_point('podman-compose==1.0.6', 'console_scripts', 'podman-compose')()) File "/usr/lib/python3.9/site-packages/podman_compose.py", line 2940, in main podman_compose.run() File "/usr/lib/python3.9/site-packages/podman_compose.py", line 1420, in run self._parse_compose_file() File "/usr/lib/python3.9/site-packages/podman_compose.py", line 1567, in _parse_compose_file raise RuntimeError(f"missing networks: {missing_nets_str}") RuntimeError: missing networks: podman
|
好吧,Fxxx。看了下Podman 要求所有网络必须显式定义或标记为外部网络,而Docker不需要。但是难道要一直改docker-compose.yaml的内容吗每次升级,而且对项目不够了解,懒得去知道哪个端口需要对外提供服务,不想浪费时间了,ByeBye podman。
安装docker
先卸载podman
yum remove podman.x86_64 podman-catatonit.x86_64 podman-docker.noarch podman-plugins.x86_64
安装docker
1
2
3
| yum config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable --now docker
|
试一下:docker run hello-world
,yoho?:
docker: Cannot connect to the Docker daemon at unix:///run/podman/podman.sock. Is the docker daemon running?
清理podman
1
2
| unset DOCKER_HOST
rm -f /run/podman/podman.sock
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
|
成功
继续安装Dify
1
2
| docker compose pull
compose up -d
|
终于跑起来了
所以使用podman compose部署dify,最终是放弃,并用回docker。虽然是小问题,但是我懒,比起折腾宁愿写个blog。或者等官方提供个兼容podman的docker-compose.yaml吧,但是我是不需要了。