Docker-compose file configuration

How to map serial port information in docker-compose file.I am on windows and if using window container. Did it the correct way?

docker-compose.yml

version: '2.1'

services:
  ise-4000:
    image: ise-4000
    build: .
    ports:
      - 5555:5555
    devices:
      - "COM3:COM3"

If using linux container, is the correct way?

version: '2.1'

services:
  ise-4000:
    image: ise-4000
    build: .
    ports:
      - 5555:5555
    devices:
      - "COM3:devttyUSB1"

Source: StackOverflow