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?
Table of contents vue custom directive Global Dir...
Preface The most widely used database in Linux is...
I have written an example before, a simple UDP se...
Table of contents Function definition method Func...
I used vue and bootstrap to make a relatively sim...
Today, database operations are increasingly becom...
A process is a program code that runs in the CPU ...
Overview The cloud platform customer's server...
Install Docker You have to install Docker, no fur...
Hyperlink Hyperlinks are the most frequently used ...
This article shares the specific code of Vue to i...
When we are writing projects, we often encounter ...
Simply put, delayed replication is to set a fixed...
This article describes how to set the automatic c...
Scenario: After installing the latest version of ...