<p>I'm under the impression that the equivalent of the following command can't be put into a <code>Dockerfile</code> or <code>Dockerfile.dev</code>:</p>

<pre><code>docker run -p 5432:5432 -v /home/app/database/db-files:/var/lib/postgresql/data sockpuppet/database
</code></pre>

<p>The <code>-p 5432:5432</code> I was using to bind to the local port so I could connect to Postgres with pgAdmin. This is not an absolute requirement, but a nice to have. <strong>Perhaps there is a better way of doing this?</strong></p>

<p>The <code>-v /home/app/database/db-files:/var/lib/postgresql/data</code> so I can persist data on the local volume.</p>

<p>The problem is <code>EXPOSE</code> in a <code>Dockerfile</code>, as far as I know, just opens ports between containers. The problem with <code>VOLUME</code> in a <code>Dockerfile</code> is that it just refers to the image's file system.</p>

<p>The bigger issue I'm having a hard time understanding is the Skaffold <code>skaffold.yaml</code> refers to these <code>Dockerfile</code>`Dockerfile.dev` when running the containers:</p>

<pre><code>apiVersion: skaffold/v1beta2
kind: Config
build:
  local:
    push: false
  artifacts:
    - image: sockpuppet/client
      context: client
      docker:
        dockerfile: Dockerfile.dev
      sync:
        '**/*.js': .
        '**/*.css': .
        '**/*.html': .
    - image: sockpuppet/server
      context: server
      docker:
        dockerfile: Dockerfile.dev
      sync:
        '**/*.js': .
deploy:
  kubectl:
    manifests:
      - k8s/client-deployment.yaml
      - k8s/server-deployment.yaml
      - k8s/server-cluster-ip-service.yaml
      - k8s/client-cluster-ip-service.yaml
</code></pre>

<p>So how am I supposed to bind ports and map volumes if they can't be specified in <code>Dockerfile</code>? Do I just need to run <code>docker run -p 5432:5432 -v /home/app/database/db-files:/var/lib/postgresql/data ishraqiyun77/database</code> manually every time I want to start up the DB?</p>

<p>Repo I'm using as a reference if that is helpful: <a href="https://github.com/StephenGrider/DockerCasts/tree/master/complex" rel="nofollow noreferrer">https://github.com/StephenGrider/DockerCasts/tree/master/complex</a></p>

cjones
<p>The <code>skaffold.yaml</code> is there to help with build and deployment of <code>k8s</code>.  If you want to do port-exposing and volume mapping, you should do that in the various <code>.yaml</code> files in the <code>manifests</code> section.  The <code>EXPOSE</code> keyword in your <code>Dockerfile</code>s simply tells the newly-created image which ports to allow for exposing and forwarding; it is only in your <code>k8s</code> containers that you actually do the mapping of ports and volumes to the host machine.</p>

<p>Disclosure: I am an <a href="https://enterprisedb.com" rel="nofollow noreferrer">EnterpriseDB (EDB)</a> employee</p>
