Postgres¶
The corresponding FreeBSD14.3p5-amd64 images are available on Github, DockerHub and Quay. CI/CD pipelines will soon add amd64/aarch64 support for 15.0, 14.snap, 15.snap and 16.snap.
- Upstream repo: https://github.com//docker-library/postgres
- FreeBSD fork: https://github.com/matias-pizarro/docker-postgres
images/14.3/postgres/18/Containerfile
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
FROM ghcr.io/matias-pizarro/freebsd-oci-containers/freebsd-zfs:14.3
RUN /usr/bin/env pkg install -yr FreeBSD-base FreeBSD-locales \
&& rm -f /var/cache/pkg/* \
&& rm -rf /var/db/pkg/*
ENV PG_MAJOR 18
ENV PGDATA /var/db/postgres/data18
ENV UNIX_SOCKET_DIRECTORIES /var/run/postgresql
VOLUME /var/db/postgres/data18
RUN /usr/bin/env pkg install -yr FreeBSD-ports\
postgresql18-server \
&& rm -f /var/cache/pkg/* \
&& rm -rf /var/db/pkg/*
RUN sysrc postgresql_enable="YES"
RUN sysrc postgresql_flags="-o '-k ${UNIX_SOCKET_DIRECTORIES}' -l ${PGDATA}/postgres.log -w -s -m fast"
RUN mkdir -p ${UNIX_SOCKET_DIRECTORIES} && chown postgres:postgres ${UNIX_SOCKET_DIRECTORIES}
RUN mkdir /docker-entrypoint-initdb.d && chown postgres:postgres /docker-entrypoint-initdb.d
COPY etc.login.conf /tmp/etc.login.conf
RUN cat /tmp/etc.login.conf >> /etc/login.conf \
&& cap_mkdb /etc/login.conf \
&& sysrc postgresql_login_class="postgres" \
&& pw user mod -L postgres -n postgres \
&& rm -f /tmp/etc.login.conf
RUN set -ex; \
postgres --version
COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
RUN ln -s docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh
ENTRYPOINT ["docker-entrypoint.sh"]
# We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL
# calls "Fast Shutdown mode" wherein new connections are disallowed and any
# in-progress transactions are aborted, allowing PostgreSQL to stop cleanly and
# flush tables to disk.
#
# See https://www.postgresql.org/docs/current/server-shutdown.html for more details
# about available PostgreSQL server shutdown signals.
#
# See also https://www.postgresql.org/docs/current/server-start.html for further
# justification of this as the default value, namely that the example (and
# shipped) systemd service files use the "Fast Shutdown mode" for service
# termination.
#
STOPSIGNAL SIGINT
#
# An additional setting that is recommended for all users regardless of this
# value is the runtime "--stop-timeout" (or your orchestrator/runtime's
# equivalent) for controlling how long to wait between sending the defined
# STOPSIGNAL and sending SIGKILL.
#
# The default in most runtimes (such as Docker) is 10 seconds, and the
# documentation at https://www.postgresql.org/docs/current/server-start.html notes
# that even 90 seconds may not be long enough in many instances.
EXPOSE 5432
CMD ["postgres"]
images/14.3/postgres/18/build.sh
podman build \
--env IGNORE_OSVERSION=yes \
--env ABI=FreeBSD:14:$(sysctl -n hw.machine_arch) \
--env OSVERSION=1403000 \
--env VERSION_MINOR=3 \
--no-hosts \
--tag postgres:18-freebsd \
--tag postgres:18-freebsd14 \
--tag postgres:18-freebsd14.3 \
--tag postgres:freebsd \
--tag postgres:freebsd14 \
--tag postgres:freebsd14.3 \
--file Containerfile
images/14.3/postgres/18/push.sh
# Github
echo
echo "################################################################################"
IMAGE_PATH="ghcr.io/matias-pizarro/freebsd-oci-containers"
echo "Pushing postgres-18 to ${IMAGE_PATH}"
echo
echo "postgres:18-freebsd"
podman tag localhost/postgres:18-freebsd "${IMAGE_PATH}"/postgres:18-freebsd
podman push "${IMAGE_PATH}"/postgres:18-freebsd
echo
echo "postgres:18-freebsd14"
podman tag localhost/postgres:18-freebsd14 "${IMAGE_PATH}"/postgres:18-freebsd14
podman push "${IMAGE_PATH}"/postgres:18-freebsd14
echo
echo "postgres:18-freebsd14.3"
podman tag localhost/postgres:18-freebsd14.3 "${IMAGE_PATH}"/postgres:18-freebsd14.3
podman push "${IMAGE_PATH}"/postgres:18-freebsd14.3
echo
echo "postgres:freebsd"
podman tag localhost/postgres:freebsd "${IMAGE_PATH}"/postgres:freebsd
podman push "${IMAGE_PATH}"/postgres:freebsd
echo
echo "postgres:freebsd14"
podman tag localhost/postgres:freebsd14 "${IMAGE_PATH}"/postgres:freebsd14
podman push "${IMAGE_PATH}"/postgres:freebsd14
echo
echo "postgres:freebsd14.3"
podman tag localhost/postgres:freebsd14.3 "${IMAGE_PATH}"/postgres:freebsd14.3
podman push "${IMAGE_PATH}"/postgres:freebsd14.3
# Docker
echo
echo "################################################################################"
IMAGE_PATH="docker.io/matiaspizarro"
echo "Pushing postgres-18 to ${IMAGE_PATH}"
echo
echo "postgres:18-freebsd"
podman tag localhost/postgres:18-freebsd "${IMAGE_PATH}"/postgres:18-freebsd
podman push "${IMAGE_PATH}"/postgres:18-freebsd
echo
echo "postgres:18-freebsd14"
podman tag localhost/postgres:18-freebsd14 "${IMAGE_PATH}"/postgres:18-freebsd14
podman push "${IMAGE_PATH}"/postgres:18-freebsd14
echo
echo "postgres:18-freebsd14.3"
podman tag localhost/postgres:18-freebsd14.3 "${IMAGE_PATH}"/postgres:18-freebsd14.3
podman push "${IMAGE_PATH}"/postgres:18-freebsd14.3
echo
echo "postgres:freebsd"
podman tag localhost/postgres:freebsd "${IMAGE_PATH}"/postgres:freebsd
podman push "${IMAGE_PATH}"/postgres:freebsd
echo
echo "postgres:freebsd14"
podman tag localhost/postgres:freebsd14 "${IMAGE_PATH}"/postgres:freebsd14
podman push "${IMAGE_PATH}"/postgres:freebsd14
echo
echo "postgres:freebsd14.3"
podman tag localhost/postgres:freebsd14.3 "${IMAGE_PATH}"/postgres:freebsd14.3
podman push "${IMAGE_PATH}"/postgres:freebsd14.3
# Quay
echo
echo "################################################################################"
IMAGE_PATH="quay.io/matiaspizarro"
echo "Pushing postgres-18 to ${IMAGE_PATH}"
echo
echo "postgres:18-freebsd"
podman tag localhost/postgres:18-freebsd "${IMAGE_PATH}"/postgres:18-freebsd
podman push "${IMAGE_PATH}"/postgres:18-freebsd
echo
echo "postgres:18-freebsd14"
podman tag localhost/postgres:18-freebsd14 "${IMAGE_PATH}"/postgres:18-freebsd14
podman push "${IMAGE_PATH}"/postgres:18-freebsd14
echo
echo "postgres:18-freebsd14.3"
podman tag localhost/postgres:18-freebsd14.3 "${IMAGE_PATH}"/postgres:18-freebsd14.3
podman push "${IMAGE_PATH}"/postgres:18-freebsd14.3
echo
echo "postgres:freebsd"
podman tag localhost/postgres:freebsd "${IMAGE_PATH}"/postgres:freebsd
podman push "${IMAGE_PATH}"/postgres:freebsd
echo
echo "postgres:freebsd14"
podman tag localhost/postgres:freebsd14 "${IMAGE_PATH}"/postgres:freebsd14
podman push "${IMAGE_PATH}"/postgres:freebsd14
echo
echo "postgres:freebsd14.3"
podman tag localhost/postgres:freebsd14.3 "${IMAGE_PATH}"/postgres:freebsd14.3
podman push "${IMAGE_PATH}"/postgres:freebsd14.3
Supported tags and respective Containerfile links
images/14.3/postgres/18/LICENSE
Copyright (c) 2014, Docker PostgreSQL Authors (See AUTHORS)
files under license:
(source: https://github.com/docker-library/postgres)
docker-ensure-initdb.sh
docker-entrypoint.sh
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.