Add bind mount to Dockerfile just like volume

A Dockerfile defines how an image is built, not how it’s used – so you can’t specify the bind mount in a Dockerfile. Try using docker-compose instead. A simple docker-compose.yml that mounts a directory for you would look like this:

version: '3.1'

services:
  mycontainer:
    image: myimage
    build: .
    volumes:
      - './path/on/docker/host:/path/inside/container'  

The build: . is optional if you’re building the image by some other means, but sometimes it’s handy to do it all in one.

Run this with docker-compose up -d

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)