Sign inSign up

padaliarushabh/cveid_flask_prototype

By padaliarushabh

•Updated over 1 year ago

This container provides a Flask application paired with a MySQL database

Image
Security
Databases & storage
0

771

padaliarushabh/cveid_flask_prototype repository overview

⁠Running with local MYSQL

⁠Copy the below docker-composer.yaml file

version: "3.8"

services:
  app:
    image: padaliarushabh/cveid_flask_prototype:latest
    ports:
      - "5000:5000"
    environment:
      # Use host.docker.internal for Windows/macOS and 172.17.0.1 for Linux
      - MYSQL_HOST=${MYSQL_HOST:-host.docker.internal}
      - MYSQL_PORT=3306
      - MYSQL_USER=root
      - MYSQL_PASSWORD=root@123
      - MYSQL_DATABASE=nvd_cves
    network_mode: "${NETWORK_MODE:-bridge}" # Use host network mode on Linux if needed
⁠Windows/macOS

No additional configuration is needed since host.docker.internal works out of the box.

docker-compose up
⁠Linux

Find your host IP address: Use the IP address of the docker0 interface (e.g., 172.17.0.1).

ip addr show docker0

Run docker composer

MYSQL_HOST=172.17.0.1 docker-compose up

Or switch to network_mode: host for simpler networking:

NETWORK_MODE=host MYSQL_HOST=127.0.0.1 docker-compose up

⁠Use Container MYSQL

Create the folder db-init and add your SQL file to execute it.

Copy the below docker-compose.yaml

#!/bin/bash

version: "3.8"

services:
  app:
    image: padaliarushabh/cveid_flask_prototype:latest
    ports:
      - "5000:5000"
    environment:
      - MYSQL_HOST=mysql
      - MYSQL_PORT=3306
      - MYSQL_USER=root
      - MYSQL_PASSWORD=root@123
      - MYSQL_DATABASE=nvd_cves
    depends_on:
      - mysql

  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: root@123
      MYSQL_DATABASE: nvd_cves
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
      - ./db-init:/docker-entrypoint-initdb.d #update this path to point to your folder containing the SQL file
volumes:
  mysql_data:

Run the command to build

docker-compose up --build -d

If SQL has errors, run the command below. This removes all volumes declared in your docker-compose.yml. When you bring it back up, MySQL has no existing data and will run the init scripts.

docker-compose down -v

Tag summary

Content type

Image

Digest

sha256:ef3ffba92…

Size

98.3 MB

Last updated

over 1 year ago

docker pull padaliarushabh/cveid_flask_prototype