Docker Community Forums

Share and learn in the Docker community.

Docker container cannot access external HDD

Dear all,

I am running a docker container in my terminal and all mounted working directories are on an external HDD.
For some commands docker tells me that it does not have all rights to write on the external HDD.
The parent path (/volumes) to the external HDD is listed in “shared files”.

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: attempt to write a readonly database

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

Traceback (most recent call last):
  File "/usr/local/miniconda/bin/fmriprep", line 10, in <module>
    sys.exit(main())
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 17, in main
    parse_args()
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/parser.py", line 610, in parse_args
    config.from_dict(vars(opts))
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/config.py", line 634, in from_dict
    execution.load(settings)
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/config.py", line 218, in load
    cls.init()
  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/config.py", line 459, in init
    re.compile(r"^\."),
  File "/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/layout.py", line 152, in __init__
    database_path, reset_database, config, init_args)
  File "/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/db.py", line 48, in __init__
    self.reset_database(init_args, config)
  File "/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/db.py", line 107, in reset_database
    Base.metadata.create_all(self.engine)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/sql/schema.py", line 4665, in create_all
    ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2095, in _run_visitor
    conn._run_visitor(visitorcallable, element, **kwargs)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1656, in _run_visitor
    visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/sql/visitors.py", line 145, in traverse_single
    return meth(obj, **kw)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/sql/ddl.py", line 787, in visit_metadata
    _is_metadata_operation=True,
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/sql/visitors.py", line 145, in traverse_single
    return meth(obj, **kw)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/sql/ddl.py", line 832, in visit_table
    include_foreign_key_constraints,  # noqa
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
    return meth(self, multiparams, params)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1073, in _execute_ddl
    compiled,
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1317, in _execute_context
    e, statement, parameters, cursor, context
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1511, in _handle_dbapi_exception
    sqlalchemy_exception, with_traceback=exc_info[2], from_=e
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) attempt to write a readonly database
[SQL: 
CREATE TABLE configs (
	name VARCHAR NOT NULL, 
	_default_path_patterns VARCHAR, 
	PRIMARY KEY (name)
)

What Do I need to do?

Best,
Steph

I’ve not read the full error log, but just in case an external disk could be compared to a network drive for SQLite:

Note that using SQLite on a network drive is very much never recommended and can yield weird errors. So, I’d take SQLite out of the equation for a bit: does accessing regular files work fine?

(You could use exec -it to connect to the running container, to test from its command line?)