mysql docker container exited with code 1

There are some files in /var/lib/mysql directory. Remove everything from this directory. Or highly recommended, use volumes in docker-compose.yml.

volumes:
  - /my/own/datadir:/var/lib/mysql

Update: I tested with the following compose file, it worked fine without any errors.

version: '3.7'

services:
  db:
    image: mysql:5.7
    restart: always
    volumes:
    - ./data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: pass
      MYSQL_DATABASE: star
      MYSQL_USER: user
      MYSQL_PASSWORD: pass