title: How do I create a docker image from dockerfile and then make a config file available on a volume when running the image from docker-compsose
body: <p>I am creating a docker container running a python script that collects telemetry. The dockerfile looks like this.</p>
  
  <pre><code>FROM python:3.7-alpine
  
  WORKDIR /app
  
  COPY src/requirements.txt ./
  
  RUN pip install -r requirements.txt
  
  COPY src /app
  
  CMD [ "python", "main.py" ]
  </code></pre>
  
  <p>inside the folder 'src' is a folder 'config' with 'config.json' saved 
  src/config/config.json</p>
  
  <p>the docker-compose file looks like this</p>
  
  <pre class="lang-yaml prettyprint-override"><code>version: '2.2'
  services:
  
     umpmfd:
       container_name: mfdwebsockets
       build: mfdwebsockets
       network_mode: "host"
       restart: always
       volumes:
         - "/home/xtp/config.json:/app/config/config.json"   
       depends_on:
         - influxdb
         - grafana
  </code></pre>
  
  <p>I want to have the 'config.json' file available on the host machine so I can change the config with out stopping and restarting the container. At the moment I am getting this error.</p>
  
  <blockquote>
    <p>ERROR: for mfdwebsockets  Cannot start service umpmfd: OCI runtime
    create failed<br>
    : container_linux.go:346: starting container process caused
    "process_linux.go:44<br>
    9: container init caused \"rootfs_linux.go:58: mounting
    \\"/home/xtp/config.jso<br>
    n\\" to rootfs
    \\"/var/lib/docker/overlay2/c5a992a5717f2d510e75056ba38ad4075a0<br>
    31e73ca010fef5da8328ad366eaad/merged\\" at
    \\"/var/lib/docker/overlay2/c5a992a<br>
    5717f2d510e75056ba38ad4075a031e73ca010fef5da8328ad366eaad/merged/app/config/conf
    ig.json\\" caused \\"not a directory\\"\"": unknown: Are you trying
    to mount<br>
    a directory onto a file (or vice-versa)? Check if the specified host
    path exists<br>
    and is the expected type</p>
    
    <p>ERROR: for umpmfd  Cannot start service umpmfd: OCI runtime create
    failed: conta<br>
    iner_linux.go:346: starting container process caused
    "process_linux.go:449: cont<br>
    ainer init caused \"rootfs_linux.go:58: mounting
    \\"/home/xtp/config.json\\" t<br>
    o rootfs
    \\"/var/lib/docker/overlay2/c5a992a5717f2d510e75056ba38ad4075a031e73ca
    010fef5da8328ad366eaad/merged\\" at
    \\"/var/lib/docker/overlay2/c5a992a5717f2d<br>
    510e75056ba38ad4075a031e73ca010fef5da8328ad366eaad/merged/app/config/config.json
    \\" caused \\"not a directory\\"\"": unknown: Are you trying to
    mount a direc<br>
    tory onto a file (or vice-versa)? Check if the specified host path
    exists and is<br>
    the expected type</p>
  </blockquote>
  
  <p>What do I need to change to get this config.json file available as a volume on the host machine?       </p>