How to Run Next.js 16 with MySQL and phpMyAdmin Using Docker Compose
NextJS

How to Run Next.js 16 with MySQL and phpMyAdmin Using Docker Compose

Next.js 16 + MySQL + phpMyAdmin: A Docker Setup Guide

Author
Richard Mendes
January 07, 2026 • 5 mins

This article provides a minimal Docker configuration for running a Next.js 16 application on Node.js 22, backed by MySQL, with phpMyAdmin for database management. The focus is strictly on the Dockerfile and docker-compose.yml needed for local development. Application code and Next.js project creation are intentionally out of scope.

If you already have a Next.js 16 project, you can drop these files into your project root and start the entire stack with a single command.

Prerequisites:

  1. Docker Desktop
  2. Git Bash or Command line

Project Structure

Docker Configuration Files for Next.js 16 and MySql

Below are the only two files required for this setup.

Dockerfile (Next.js 16 + Node 22)

FROM node:22-alpine

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "run", "dev"]

docker-compose.yml

version: "3.9"

services:
web:
build: .
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
env_file:
- .env
environment:
- WATCHPACK_POLLING=true
depends_on:
- db

db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: mainpassword
MYSQL_DATABASE: nextappdb
MYSQL_USER: root
MYSQL_PASSWORD: password123
volumes:
- mysql_data:/var/lib/mysql

phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
ports:
- "8080:80"
environment:
PMA_HOST: db
PMA_USER: root
PMA_PASSWORD: password123
depends_on:
- db

volumes:
mysql_data:

Bonus: Shadcn UI Component Finder

If you’re using shadcn/ui in your Next.js projects, I built a small tool that helps you quickly find shadcn UI components and blocks without manually searching through repositories.

👉 Youtube Url

https://youtu.be/OV9Nzlrv6x0

👉 Shadcn Block Finder

https://www.getmakedigital.com/ai-tools/shadcn-block-finder

Comments (0)

No comments yet. Be the first to comment!

Latest Articles