Airflow keeps restarting in docker, getting the following error logs

This repeats in the logs for the container running airflow scheduler.

Traceback (most recent call last):
  File "/usr/bin/airflow", line 21, in <module>
    from airflow import configuration
  File "/usr/lib/python3.7/site-packages/airflow/__init__.py", line 44, in <module>
    settings.initialize()
  File "/usr/lib/python3.7/site-packages/airflow/settings.py", line 335, in initialize
    LOGGING_CLASS_PATH = configure_logging()
  File "/usr/lib/python3.7/site-packages/airflow/logging_config.py", line 68, in configure_logging
    raise e
  File "/usr/lib/python3.7/site-packages/airflow/logging_config.py", line 63, in configure_logging
    dictConfig(logging_config)
  File "/usr/lib/python3.7/logging/config.py", line 800, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python3.7/logging/config.py", line 571, in configure
    '%r' % name) from e
ValueError: Unable to configure handler 'processor'
Unable to load the config, contains a configuration error.
Traceback (most recent call last):
  File "/usr/lib/python3.7/logging/config.py", line 563, in configure
    handler = self.configure_handler(handlers[name])
  File "/usr/lib/python3.7/logging/config.py", line 736, in configure_handler
    result = factory(**kwargs)
  File "/usr/lib/python3.7/site-packages/airflow/utils/log/file_processor_handler.py", line 50, in __init__
    os.makedirs(self._get_log_directory())
  File "/usr/lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  [Previous line repeated 2 more times]
  File "/usr/lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/code'

The above exception was the direct cause of the following exception:

I’ve tried changing ownership of the repository to my own but this still occurs. If anyone knows how to fix this would be greatly appreciated. Thanks.

I got a similar problem and it is specific to my machine. Any updates on this?