0

If use the official postgres image:

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

is a simple way to use PostgreSQL database.

But if I need to use some PostgreSQL extention such as pgroonga:

https://pgroonga.github.io

How to add this to that official PostgreSQL image?

Run that image as a container, then sign in to it add extention, finally make a new image? Is it possible?

If there exists a official pgroonga image will be good, but there isn't now:

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

The last way, make a image for groonga, the links to postgres container when run the full stack.

Which way is good to such a case when using container to deploy mordern web application?

cloud_cloud
  • 1,921
  • 4
  • 16
  • 30
  • Possible duplicate of [How to extend existing docker container?](https://stackoverflow.com/questions/41830688/how-to-extend-existing-docker-container) – Dan Lowe Jul 07 '17 at 04:29

1 Answers1

2

You should have a look (let us suppose you will use Debian) at

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

So you have some commands to launch, so more or less such a Dockerfile should do the trick

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 \ &&...

I guess you see the method

Remember that in a Dockerfile, you can't answer "Yes" or "no" to any command, so you must automate all the commands. If you can't automate all, you can do some part, get an image, launch it with a bash prompt (or sh or zsh...), do interactively the needed commands hard to automate, and then you

docker commit

see the doc

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

also, in a Dockerfile, by default, you are root, so no need to sudo unless you use the Dockerfile directive

USER myuser

user2915097
  • 30,758
  • 6
  • 57
  • 59