title: sqlite database in docker volume not opening
body: <p>I am trying to create an sqlite db on a volume within a docker container. When execution reaches <code>c = conn.cursor()</code> a receive the following error:</p>
  
  <pre><code>sqlite3.ProgrammingError: Cannot operate on a closed database.
  </code></pre>
  
  <p>I wanted to re-use the connection process so built the following functions, which I think might be where the problem is:</p>
  
  <pre><code>def create_sqlite_conn(db):
      try:
          conn = sqlite3.connect(db, detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)
          return conn
      except sqlite3.Error as e:
          logging.warning("WARNING: Error accessing DB: {}".format(db), e)
      finally:
          conn.close()
  
  def create_db(db):
      conn = create_sqlite_conn(db)
      c = conn.cursor()
      c.execute('''CREATE TABLE table1(id INTEGER PRIMARY KEY AUTOINCREMENT, ip_ver TEXT, date_time DATETIME)''')
      conn.commit()
  </code></pre>
  
  <p>This is called with:</p>
  
  <pre><code>create_db('/home/web/data/new_db.sql')
  </code></pre>
  
  <p>This code runs outside of the docker container, which is why I wonder whether this is alpine or docker related. My docker file looks like this:</p>
  
  <pre><code>FROM alpine:3.7
  
  RUN apk --no-cache add python3 build-base linux-headers python3-dev \
          &amp;&amp; pip3 install virtualenv \
          &amp;&amp; addgroup -g 500 web \
          &amp;&amp; adduser -D -u 1000 -G web web
  
  WORKDIR /home/web
  
  ENV PYTHONPATH /home/web/myapp
  
  USER web
  
  RUN mkdir -p /home/web/env /home/web/myapp /home/web/data/
  
  COPY myapp/__init__.py /home/web/myapp/
  COPY myapp/myapp.py /home/web/myapp/
  COPY setup.py /home/web/myapp/
  COPY requirements.txt /home/web/myapp/
  COPY README.txt /home/web/myapp/
  
  RUN /usr/bin/virtualenv -p python3 /home/web/env \
          &amp;&amp; source /home/web/env/bin/activate \
          &amp;&amp; python -m pip install ./myapp/ \
          &amp;&amp; python -m pip install -r ./myapp/requirements.txt
  
  VOLUME ["./data"]
  
  CMD ["/home/web/env/bin/myapp"]
  </code></pre>
  
  <p>Starting the docker container I have tried with and without the '--privileged' flag and still get the same error.</p>
  
  <p>Thanks,</p>