<p>I have a docker-compose.yml file that has my configuration on importing an external file that installs a postgis configuration when creating a docker image for Postgres,</p>
<p>This is the docker file</p>
<pre><code>services:
  postgres:
    container_name: postgres_db
    build:
      context: .
      dockerfile: Dockerfile-db
    image: postgres
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: password
      PGDATA: /data/postgres
    volumes:
      - postgres:/data/postgres
    ports:
      - &quot;5454:5454&quot;
    networks:
      - postgres
</code></pre>
<p>the file am importing is called <code>Dockerfile-db</code> .</p>
<pre><code>FROM postgres:14.1


RUN apt-get update &amp;&amp; apt-get  install -y postgresql-14-postgis-3  


CMD [&quot;/usr/local/bin/docker-entrypoint.sh&quot;,&quot;postgres&quot;]
</code></pre>
<p>How can I do the same import on a K8 manifest file. this is where I add the database</p>
<pre><code>spec:
  serviceName: zone-service-db-service
  selector:
    matchLabels:
      app: zone-service-db
  replicas: 1
  template:
    metadata:
      labels:
        app: zone-service-db
    spec:
      tolerations:
        - key: &quot;podType&quot;
          operator: &quot;Equal&quot;
          value: &quot;isDB&quot;
          effect: &quot;NoSchedule&quot;
      containers:
        - name: postgres
          image: postgres:latest
          imagePullPolicy: &quot;IfNotPresent&quot;
          ports:
            - containerPort: 5432
          envFrom:
            - configMapRef:
                name: zone-service-db
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgredb
          resources:
            requests:
              memory: '256Mi'
              cpu: '100m'
            limits:
              memory: '256Mi'
      volumes:
        - name: postgredb
          persistentVolumeClaim:
            claimName: zone-service-pv-claim
</code></pre>
<p>How can I import the <code>Dockerfile-db</code> on the k8 manifest file and be called during the creating of the Postgres container and have the extensions available on the docker-image? Any help is appreciated</p>

justrying
<p>I believe you are getting this error</p>
<pre><code>ERROR:  type &quot;geometry&quot; does not exist
</code></pre>
<p>The file you have added above will mostly work with <code>docker-compose</code> but for Kubernetes, to have both Postgress and Postgis work together you will have to us the postgis image instead of the postgres image like this</p>
<pre><code>spec:
  serviceName: zone-service-db-service
  selector:
    matchLabels:
      app: zone-service-db
  replicas: 1
  template:
    metadata:
      labels:
        app: zone-service-db
    spec:
      tolerations:
        - key: &quot;podType&quot;
          operator: &quot;Equal&quot;
          value: &quot;isDB&quot;
          effect: &quot;NoSchedule&quot;
      containers:
        - name: postgres
          image: postgis/postgis:latest
          imagePullPolicy: &quot;IfNotPresent&quot;
          ports:
            - containerPort: 5432
          envFrom:
            - configMapRef:
                name: zone-service-db
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgredb
          resources:
            requests:
              memory: '256Mi'
              cpu: '100m'
            limits:
              memory: '256Mi'
      volumes:
        - name: postgredb
          persistentVolumeClaim:
            claimName: zone-service-pv-claim
</code></pre>
<p>Try this and advise. No need to import external files.</p>
