可以按以下步骤进行:
bashsudo apt-get update
bashsudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
bashcurl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
bashsudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
bashsudo apt-get update
bashsudo apt-get install docker-ce
bashsudo systemctl start docker
sudo systemctl enable docker
bashsudo docker run hello-world
如果能正常输出Hello World信息,则Docker安装成功。 9. 安装Docker Compose(可选)
bashsudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
bashsudo apt update
bashsudo apt install -y curl gnupg-agent software-properties-common
bashcurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
bashecho "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
bashsudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io
bashsudo docker run hello-world
bashdocker pull nacos/nacos-server
使用nacos的嵌入式数据库
bash# 不用MySQL
docker run -d -p 8848:8848 --env JVM_XMS=128m --env JVM_XMX=300m --env JVM_XMN=128m -e MODE=standalone nacos/nacos-server
使用MySQL作为Nacos的数据库
下载nacos-db.sql脚本
sql脚本路径:nacos-develop/nacos-develop/config/src/main/resources/META-INF
bash# 先提前创建好表,再创建容器
docker run -d -p 8848:8848 --env JVM_XMS=128m --env JVM_XMX=300m --env JVM_XMN=128m -e MODE=standalone -e SPRING_DATASOURCE_PLATFORM=mysql -e MYSQL_SERVICE_HOST=localhost -e MYSQL_SERVICE_PORT=3306 -e MYSQL_SERVICE_DB_NAME=nacos_config -e MYSQL_SERVICE_USER=user -e MYSQL_SERVICE_PASSWORD=password nacos/nacos-server
浏览器访问:ip:8848/nacos