Files
GoETAAPI/db/container/README.md

1.2 KiB

ETAv2SQL

Docker Container to deploy MySQL with schema and content init

Build Docker image

docker buildx build -t eta/eta-db .

Run Docker container

docker run --name eta-db -d -p3306:3306 eta/eta-db
docker logs -f eta-db

Container will generate automatically a SQL root password

Environment Variables

You can setup a database name and grant access to it with user/password using the following env vars

  • MYSQL_DATABASE
  • MYSQL_USER
  • MYSQL_PASSWORD
docker run --name eta-db -e MYSQL_DATABASE=u947463964_etaviaporte -e MYSQL_USER=etaapi -e MYSQL_PASSWORD="secret_password" -d -p3306:3306 eta/eta-db

Schemas and SQL scripts

You can add schemas and sql scripts to the container to setup the database on startup by mounting a directory with sql scripts on /docker-entrypoint-initdb.d

docker run --name eta-db -e MYSQL_DATABASE=u947463964_etaviaporte -e MYSQL_USER=etaapi -e MYSQL_PASSWORD="secret_password" -v ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d -d -p3306:3306 eta/eta-db

Known Issues

  • When loading a script, errors my araise when using " instead of ' and when comments appear at the end of a command