docker - 如何使用 docker 文件路径连接到 firebird 的 docker 镜像?

标签 docker docker-compose firebird2.5

我有一个 firebird DB 图像在端口 3050 上运行,我需要通过 url 访问该图像内的文件,这样我就可以创建一个 firebird 连接(是的 firebird 需要一个文件路径),但我无法使用网址 有没有办法在 docker 中公开文件,并使其可以通过 url 访问?示例 localhost:3050/databases/test.fdb << 我需要通过 dbeaver 连接到此

its runnning normally on the 3050

heres the file I need to access via url (thats inside the container) (位于/databases)

How I'm trying to connect

最佳答案

需要使用绝对路径/databases/DREAMCLUB.FDB ,而不是相对路径 databases/DREAMCLUB.FDB 。另请参阅Jaybird FAQ on JDBC URLs (Jaybird 是 DBeaver 使用的 Firebird JDBC 驱动程序):

On Linux the root / should be included in the path. A database located on /opt/firebird/db.fdb should use (note the double slash after port!):

jdbc:firebirdsql://host:port//opt/firebird/db.fdb 

Jaybird JDBC Driver Java Programmer's Manual 中也有类似的提及:

On Unix platforms the path must include the root, as the path is otherwise interpreted relative to a server-dependent folder. Having to include the root has the effect that a database in /var/firebird/employee.fdb needs to use a double // after the host name (and port) in the connection string: jdbc:firebirdsql://localhost//var/firebird/employee.fdb

顺便说一句,Firebird 不要求您使用文件路径,您也可以在 aliases.conf 中定义别名。 (Firebird 2.5 及更早版本)或 databases.conf (Firebird 3.0 及更高版本)。

关于docker - 如何使用 docker 文件路径连接到 firebird 的 docker 镜像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70626882/

相关文章:

Firebird 获取包含所有可用 id 的列表

python - 如何为 Linux 和 Windows 分发带有嵌入式 Firebird SQL 的 Python 程序

Django 将 FileField 中的文件保存在 docker 容器中

docker - 可以在kubernetes容器中托管两个Web服务吗?

docker - 将挂载docker与特定用户和权限绑定(bind)

oracle - 使用 docker-compose 安装 Oracle 数据库

macos - 如何在 osx 上为 gitlab-runner exec docker 修复 'Job failed: invalid volume specification'

docker 未经授权的: authentication required - upon push with successful login

mysql - Windows 上的 Docker 在尝试启动 mysql 容器时出错

delphi - 如何在 Delphi 中使用 dbExpress 将参数传递给查询