Docker-Compose Bind Mount

Docker bind and mount provide the options to bind host port to the container port and also user can mount any of the host directories to the container as shown in the below docker-compose file.

version: '3'
    image: nginx
      - "8000:80"
      - ./ot/:/usr/share/nginx/html/

Only 1 service is defined in docker-compose YAML file and ports property specifies the binding of host port to container port and volumes specifies the mount of host directory to the container directory i.e ./ot/ is the host directory which will get mounted to /usr/share/nginx/html of the container.