【问题标题】:How to add more feature to a official postgres image from docker hub?如何从 docker hub 向官方 postgres 图像添加更多功能?
【发布时间】:2017-07-07 01:44:54
【问题描述】:

如果使用官方postgres镜像:

https://hub.docker.com/_/postgres/

是一种使用PostgreSQL数据库的简单方法。

但是如果我需要使用一些 PostgreSQL 扩展,比如 pgroonga:

https://pgroonga.github.io

如何将它添加到官方 PostgreSQL 镜像中?

将该图像作为容器运行,然后登录到它添加扩展,最后制作一个新图像?有可能吗?

如果存在官方 pgroonga 图像会很好,但现在没有:

https://hub.docker.com/u/groonga/

最后一种方式,为groonga制作一个镜像,在运行全栈时链接到postgres容器。

在使用容器部署现代Web应用时,这种情况下哪种方式好?

【问题讨论】:

标签: image postgresql docker full-text-search containers


【解决方案1】:

你应该看看(让我们假设你将使用 Debian)

https://pgroonga.github.io/install/debian.html

所以你有一些命令要启动,所以或多或少这样的 Dockerfile 应该可以解决问题

FROM postgres RUN apt udate -y && apt install -y -V apt-transport-https \ && echo "deb https://packages.groonga.org/debian/ jessie main" >> /etc/apt/sources.list.d/groonga.list \ && echo "deb-src https://packages.groonga.org/debian/ jessie main" >> /etc/apt/sources.list.d/groonga.list \ &&...

我猜你看到方法了

请记住,在 Dockerfile 中,您不能对任何命令回答“是”或“否”,因此您必须自动化所有命令。 如果您不能全部自动化,您可以做一些事情,获取图像,使用 bash 提示符(或 sh 或 zsh...)启动它,交互地执行难以自动化的所需命令,然后您

docker commit

查看文档

https://docs.docker.com/engine/reference/commandline/commit/

另外,在 Dockerfile 中,默认情况下,您是 root,因此无需 sudo,除非您使用 Dockerfile 指令

USER myuser

【讨论】:

    猜你喜欢
    • 2021-11-08
    • 1970-01-01
    • 1970-01-01
    • 2018-03-22
    • 2021-03-11
    • 1970-01-01
    • 1970-01-01
    • 2015-05-11
    • 1970-01-01
    相关资源
    最近更新 更多