We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b0a72d commit 126dfdeCopy full SHA for 126dfde
16/bookworm-no-initdb-if-exist/Containerfile
@@ -1,6 +1,9 @@
1
FROM postgres:16
2
3
-COPY docker-ensure-no-initdb-if-exist.sh /usr/local/bin/docker-ensure-initdb.sh
4
-RUN rm -f /usr/local/bin/docker-enforce-initdb.sh && ln -sT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh
+# Set working directory
+WORKDIR /var/lib/postgresql/data
5
6
-ENTRYPOINT ["docker-entrypoint.sh"]
+# Check if the database directory exists (indicates existing data)
7
+RUN [ ! -d "$PGDATA" ] && echo "Database directory not found, initializing..." || echo "Database directory found, skipping initialization."
8
+
9
+#ENTRYPOINT ["docker-entrypoint.sh"]
0 commit comments