Docker image download 1. Download nacos docker pull nacos:[version number] 2. Download MySQL docker pull mysql:[version number] 3. Install docker-compose Under Linux, you need to download it through the command: # Install curl -L https://github.com/docker/compose/releases/download/1.23.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose If the download speed is slow, or the download fails, you can use the provided docker-compose file: docker-compose-Linux_jb51.rar Upload to # Modify permissions chmod +x /usr/local/bin/docker-compose Base auto-completion commands: # Complete command curl -L https://raw.githubusercontent.com/docker/compose/1.29.1/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose If an error occurs here, you need to modify your hosts file: echo "199.232.68.133 raw.githubusercontent.com" >> /etc/hosts permission denied Permanently closed: vim /etc/sysconfig/selinux SELINUX=enforcing changed to SELINUX=disabled Restart the VM Start mysql and nacos1. Start mysql: MySQL specific configuration 2. Start nacos: docker run --env MODE=standalone --name nacos -d -p 8848:8848 nacos/nacos-server:1.4.1 3. Restart nacos and firewall: docker restart nacos //Restart nacos systemctl restart firewalld.service //Restart the firewall 4. Modify the configuration By default, Linux does not give read and write permissions to the data volume mounted by docker-compose. You need to disable selinux so that the mysql data volume can be mounted successfully. vim /etc/sysconfig/selinux SELINUX=enforcing changed to SELINUX=disabled Restart the VM Modify your own java project1. View the nacos address: View the container's IP address through Modify the connection address of mysql Modify the configuration file with nacos and mysql address submodules: If you use MySQL datasource: url: jdbc:mysql://192.168.88.130:3306/tb_user?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true Username: root password: 123456 driver-class-name: com.mysql.cj.jdbc.Driver //If you use mysql 5.x, do not add cj. Pack Use the Maven packaging tool to package each microservice in the project into Upload Linux system Copy the packaged app.jar to each corresponding subdirectory in cloud-demo1 Other modules: Upload Linux start up Enter docker-compose up -d //Start docker logs -f xxx //View logs Some problems encountered:Packaging failed: Delete the build of the parent project: <!--<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> --> Version is too high [root@localhost cloud-demo1]# docker-compose up -d Building type service unknown flag: --iidfile See 'docker build --help'. ERROR: Service 'typeservice' failed to build : Build failed Other Errors View microservice error Solution: Restart nacos first, then restart the firewall View mysql log Cause analysis: Linux prohibits docker-compose from mounting data volumes by default, so permissions need to be granted Solution: Modify the file This is the end of this article about how to deploy springcloud project with Docker in one click. For more information about deploying springcloud with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: 11 common CSS tips and experience collection
>>: 10 kinds of loading animations implemented with CSS3, pick one and go?
While the paperless world has not yet emerged, mo...
Copy code The code is as follows: 1. Sina Weibo &...
Every time after installing the system, I have to...
Mine is: <!DOCTYPE html> Blog Garden: <!...
Table of contents Implementation ideas There are ...
Some time ago, I submitted a product version to t...
Table of contents 1. BOM 2. Composition of BOM 2....
Table of contents 1. Count data is lost Solution ...
This article describes the example of MySQL sched...
The figure below shows the browser viewing rate i...
Table of contents Problem Overview Problem Reprod...
Preface Before leaving get off work, the author r...
Four practical vue custom instructions 1. v-drag ...
1. SSH remote management SSH is a secure channel ...
CSS3 can change the color of pictures. From now o...