- This is just a simple config intended for practicing writing Dockerfile and Docker Compose config
- Install Docker and Docker Compose
- Enough RAM for containers to run
- Clone this repository
git clone https://github.com/hohoaisan/simple-dockerized-nextjs-mssql.git
- Change your terminal working directory to cloned folder
cd simple-dockerized-nextjs-mssql
- Simply run
docker-compose up
and wait for it (for the first time, Docker has to pull heavy images from Docker Hub, so the time is suprisingly longer than the next time you build this) - Open http://locahost:3000 on the browser to view the result
Notice: Live reloading only works if the original files are stored in the Linux filesystem (reason), so basically when you make changes to the source code in Windows folder, it'll not work, I recommend clonning and running this in WSL2.
- Clone this repository
git clone https://github.com/hohoaisan/simple-dockerized-nextjs-mssql.git
- Change your terminal working directory to cloned folder
cd simple-dockerized-nextjs-mssql
- Change the config (database name/password - make sure nextjs and mssql have the same config, ports, uncomment
command: yarn dev
in nextjs config to override production build - Run
docker-compose up
- Make changes to the source code and live reload will do the rest for you
- Open http://locahost:3000 on the browser to view the result
Since you want to stop the project, change your terminal working directory to cloned folder:
docker-compose stop
or justCtrl+C
in the console to stop running containersdocker-compose down
to stop (if running) and remove all containers
And docker-compose start
to start containers again (if they were not removed) without rebuilding the containers from images