First, create .env and run docker-compose. SQL_HOST=db SQL_PORT=3306 SQL_USER=root SQL_PASSWORD=jh SQL_DATABASE=DB_SQLSTK docker-compose --env-file ./.env up Second, set up the environment within docker-compose.yml. version: '3.1' services: db: image: mysql command: --default-authentication-plugin=mysql_native_password environment: MYSQL_ROOT_PASSWORD: jh MYSQL_DATABASE: DB_SQLSTK volumes: - ./D..