kartoza / docker-postgis

Dockerfile for postgis
GNU General Public License v2.0
648 stars 317 forks source link

An error occurs when the container starts with a password including #. #438

Closed bkkoli closed 1 year ago

bkkoli commented 1 year ago

What is the bug or the crash?

An error occurs when the container starts with a password including #.

But After I remove # in POSTGRES_PASSWORD, It works properly.

Steps to reproduce the issue

  1. Create Configmap like below.
  2. Create Pod.
  3. See logs when Pod Create

Versions

kartoza/postgis:15-3.3

Additional context

configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: postgis-config
  namespace: geoserver
data:
  POSTGRES_HOST_AUTH_METHOD: "password"
  POSTGRES_PASSWORD: "#test1234"
  POSTGRES_USER: "postgres"

pod.yaml

piVersion: apps/v1
kind: Deployment
metadata:
  name: postgis
  namespace: geoserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgis
  template:
    metadata:
      labels:
        app: postgis
    spec:
      containers:
      - name: postgis
        image: kartoza/postgis:15-3.3
        volumeMounts:
        - mountPath: /var/lib/postgresql
          name: postgis-data
        ports:
        - containerPort: 5432
        envFrom:
        - configMapRef:
            name: postgis-config
        imagePullPolicy: Always
      volumes:
      - name: postgis-data
        persistentVolumeClaim:
          claimName: postgis-data

service.yaml

apiVersion: v1
kind: Service
metadata:
  name: postgis
  namespace: geoserver
spec:
  type: ClusterIP
  clusterIP: None
  selector:
    app: postgis
  ports:
  - name: "5432"
    port: 5432
    targetPort: 5432
  sessionAffinity: None

pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgis-data
  namespace: geoserver
spec:
  storageClassName: csi-cephfs-sc
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi

스크린샷_2023-07-11_11-41-29

NyakudyaA commented 1 year ago

This is not a bug, you need to escape special characters https://forums.docker.com/t/escaping-characters-for-environment-variables-in-dockerfiles/125273