A boilerplate Docker project for development with a mysql database, a node.js backend using Express
- nodejs: 14 + express
- mysql: 8.0
- docker
We develop this boilerplate with the following docker version: 19.03.13
docker-compose version: 1.29.0
- βοΈ nodejs 14 + express api
- βοΈ mysql 8 database
- βοΈ running this application with docker
Case if you have a mysql instance running, you must shutdown before run docker container:
$ sudo service mysql stop Then:
$ cp .env.example .env $ npm run clean:cache $ npm run build $ npm run start:background - To stop running a container, first execute the following command to get container id:
docker ps - Copy the container ID and run the following command:
docker stop <container id> To access the database container, we must get the container id first. Run the following command:
$ docker ps This previous command list all active containers.
Copy mysql container id and type the following:
$ docker exec -it <container id> bash Then, to access database via line command:
$ mysql -u <username> -p This project is licensed under the MIT License - see the LICENSE.md file for details