<p>I want to install some extensions in PosgreSQL, this is the issue what I am trying to archive:<a href="https://github.com/bitnami/bitnami-docker-postgresql/issues/346" rel="nofollow noreferrer">https://github.com/bitnami/bitnami-docker-postgresql/issues/346</a>. Now I success enable the initial folder and the next step I want to add some initial shell script to install some extension before container start. I tried to run the command in kubernetes pod before put it into initial script. when I using this command in kubernetes postgresql pod to install wget:</p>
<pre><code>apt-get install wget -y
</code></pre>
<p>shows error like this:</p>
<pre><code>E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
</code></pre>
<p>then I tried to switch to the root of the pod container:</p>
<pre><code>su -
</code></pre>
<p>it need password, I am using helm to install the postgresql:</p>
<pre><code>helm repo add bitnami https://charts.bitnami.com/bitnami
helm install my-release bitnami/postgresql
</code></pre>
<p>what should I do to install wget in the pod? I have tried this: <a href="https://docs.bitnami.com/virtual-machine/faq/administration/use-sudo/" rel="nofollow noreferrer">https://docs.bitnami.com/virtual-machine/faq/administration/use-sudo/</a></p>

Dolphin
<p>You can use initContainers in order to download a script and use it in the postgres container. The initContainer would contain <code>wget</code> and download your script and put it in a volume. You can then mount the volume in your postgres container and execute it from there</p>
<p>The values.yaml for that chart would look something like</p>
<pre class="lang-yaml prettyprint-override"><code>primary:
  initContainers:
    - name: do-something
      image: image-with-wget
      command: ['wget', 'https://myscript']
      volumeMounts:
        - name: postgres-scripts
          mountPath: /postgres/path/for/scripts
</code></pre>
<p>Instead <code>/postgres/path/for/scripts</code> add the actual path where postgres can read from, or configure postgres to read from such a path</p>
