Docker deploys nacos stand-alone version
1. Pull the image
Get the latest nacos
docker pull nacos/nacos-server
Get the specified version of nacos
docker pulll nacos/nacos-server:1.3.0
2. Import nacos database
- export database file
docker cp nacos:/home/nacos/conf/mysql-schema.sql /home/
- Create a new nacos_config database, and then import the sql file
3. Start the container
docker run -d --name nacos \
-e MODE=standalone \
-e SPRING_DATASOURCE_PLATFORM=mysql \
-e MYSQL_SERVICE_HOST=192.168.1.1 \
-e MYSQL_SERVICE_PORT=23306 \
-e MYSQL_SERVICE_DB_NAME=nacos_config \
-e MYSQL_SERVICE_USER=root \
-e MYSQL_SERVICE_PASSWORD=Abcd@2023! \
-p 29000:8848 \
nacos/nacos-server