Coder Social home page Coder Social logo

vectornguyen76 / seminar-docker Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 4.8 MB

A seminar about concepts and demonstrations when working with Docker

License: Apache License 2.0

Dockerfile 7.16% Python 11.84% CSS 12.47% HTML 18.21% JavaScript 50.32%
dev-containers docker docker-compose docker-network docker-volumes tutorial-docker

seminar-docker's People

Contributors

vectornguyen76 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

seminar-docker's Issues

In 2_volumes OperationalError with relative paths

There's an issue with relative paths on this line of python code:

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database/test.db'

Works with absolute paths:

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////app/database/test.db'

I tried to replicate this on my laptop outside of Docker and I get the same error (Windows 11).

Error log with relative paths: (First line with python open() to see if database exists)

2023-09-26 20:57:14 <_io.TextIOWrapper name='database/test.db' mode='r' encoding='UTF-8'>
2023-09-26 20:57:14  * Serving Flask app 'app'
2023-09-26 20:57:14  * Debug mode: on
2023-09-26 20:57:14 WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
2023-09-26 20:57:14  * Running on all addresses (0.0.0.0)
2023-09-26 20:57:14  * Running on http://127.0.0.1:8000
2023-09-26 20:57:14  * Running on http://172.17.0.2:8000
2023-09-26 20:57:14 Press CTRL+C to quit
2023-09-26 20:57:14  * Restarting with stat
2023-09-26 20:57:15  * Debugger is active!
2023-09-26 20:57:15  * Debugger PIN: 515-506-405
2023-09-26 20:57:15 172.17.0.1 - - [26/Sep/2023 18:57:15] "GET / HTTP/1.1" 500 -
2023-09-26 20:57:16 Traceback (most recent call last):
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
2023-09-26 20:57:16     self._dbapi_connection = engine.raw_connection()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 3288, in raw_connection
2023-09-26 20:57:16     return self.pool.connect()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 452, in connect
2023-09-26 20:57:16     return _ConnectionFairy._checkout(self)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 1267, in _checkout
2023-09-26 20:57:16     fairy = _ConnectionRecord.checkout(pool)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 716, in checkout
2023-09-26 20:57:16     rec = pool._do_get()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 170, in _do_get
2023-09-26 20:57:16     self._dec_overflow()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
2023-09-26 20:57:16     raise exc_value.with_traceback(exc_tb)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 167, in _do_get
2023-09-26 20:57:16     return self._create_connection()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 393, in _create_connection
2023-09-26 20:57:16     return _ConnectionRecord(self)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 678, in __init__
2023-09-26 20:57:16     self.__connect()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 903, in __connect
2023-09-26 20:57:16     pool.logger.debug("Error on connect(): %s", e)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
2023-09-26 20:57:16     raise exc_value.with_traceback(exc_tb)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 898, in __connect
2023-09-26 20:57:16     self.dbapi_connection = connection = pool._invoke_creator(self)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/create.py", line 637, in connect
2023-09-26 20:57:16     return dialect.connect(*cargs, **cparams)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 615, in connect
2023-09-26 20:57:16     return self.loaded_dbapi.connect(*cargs, **cparams)
2023-09-26 20:57:16 sqlite3.OperationalError: unable to open database file
2023-09-26 20:57:16 
2023-09-26 20:57:16 The above exception was the direct cause of the following exception:
2023-09-26 20:57:16 
2023-09-26 20:57:16 Traceback (most recent call last):
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2552, in __call__
2023-09-26 20:57:16     return self.wsgi_app(environ, start_response)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2532, in wsgi_app
2023-09-26 20:57:16     response = self.handle_exception(e)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2529, in wsgi_app
2023-09-26 20:57:16     response = self.full_dispatch_request()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1825, in full_dispatch_request
2023-09-26 20:57:16     rv = self.handle_user_exception(e)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1823, in full_dispatch_request
2023-09-26 20:57:16     rv = self.dispatch_request()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
2023-09-26 20:57:16     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2023-09-26 20:57:16   File "/app/app.py", line 38, in index
2023-09-26 20:57:16     tasks = Todo.query.order_by(Todo.date_created).all()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2688, in all
2023-09-26 20:57:16     return self._iter().all()  # type: ignore
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2845, in _iter
2023-09-26 20:57:16     execution_options={"_sa_orm_load_options": self.load_options},
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2268, in execute
2023-09-26 20:57:16     _add_event=_add_event,
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2134, in _execute_internal
2023-09-26 20:57:16     conn = self._connection_for_bind(bind)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2001, in _connection_for_bind
2023-09-26 20:57:16     return trans._connection_for_bind(engine, execution_options)
2023-09-26 20:57:16   File "<string>", line 2, in _connection_for_bind
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
2023-09-26 20:57:16     ret_value = fn(self, *arg, **kw)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1126, in _connection_for_bind
2023-09-26 20:57:16     conn = bind.connect()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 3264, in connect
2023-09-26 20:57:16     return self._connection_cls(self)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 148, in __init__
2023-09-26 20:57:16     err, dialect, engine
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2426, in _handle_dbapi_exception_noconnection
2023-09-26 20:57:16     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
2023-09-26 20:57:16     self._dbapi_connection = engine.raw_connection()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 3288, in raw_connection
2023-09-26 20:57:16     return self.pool.connect()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 452, in connect
2023-09-26 20:57:16     return _ConnectionFairy._checkout(self)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 1267, in _checkout
2023-09-26 20:57:16     fairy = _ConnectionRecord.checkout(pool)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 716, in checkout
2023-09-26 20:57:16     rec = pool._do_get()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 170, in _do_get
2023-09-26 20:57:16     self._dec_overflow()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
2023-09-26 20:57:16     raise exc_value.with_traceback(exc_tb)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 167, in _do_get
2023-09-26 20:57:16     return self._create_connection()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 393, in _create_connection
2023-09-26 20:57:16     return _ConnectionRecord(self)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 678, in __init__
2023-09-26 20:57:16     self.__connect()
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 903, in __connect
2023-09-26 20:57:16     pool.logger.debug("Error on connect(): %s", e)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
2023-09-26 20:57:16     raise exc_value.with_traceback(exc_tb)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 898, in __connect
2023-09-26 20:57:16     self.dbapi_connection = connection = pool._invoke_creator(self)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/create.py", line 637, in connect
2023-09-26 20:57:16     return dialect.connect(*cargs, **cparams)
2023-09-26 20:57:16   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 615, in connect
2023-09-26 20:57:16     return self.loaded_dbapi.connect(*cargs, **cparams)
2023-09-26 20:57:16 sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
2023-09-26 20:57:16 (Background on this error at: https://sqlalche.me/e/20/e3q8)
2023-09-26 20:57:16 172.17.0.1 - - [26/Sep/2023 18:57:16] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 304 -
2023-09-26 20:57:16 172.17.0.1 - - [26/Sep/2023 18:57:16] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 304 -
2023-09-26 20:57:16 172.17.0.1 - - [26/Sep/2023 18:57:16] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 304 -

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.