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'
services:
  webapp1:
    image: nginx
    ports:
      - "8000:80"
    volumes:
      - ./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.