After understanding the following article, you can deploy projects on the server. There is no need to install tomcat, jdk, mysql and other servers locally. Docker can solve it with one click.
Install docker
$ apt install -y
If the resource cannot be found, the resource library needs to be updated, the command is:
$ sudo apt-get update && sudo apt-get upgrade
View docker version
$ docker -v
For more docker-related knowledge, please pay attention to:/
Docker install mysql
$ docker pull mysql
Docker installation tomcat
$ docker pull tomcat
Start the instance
After docker pulls the above two container images, the image list can be obtained through the following commands.
$ docker images -a
You can see two images that were pulled to the local area before, and then start the instance of tomcat and mysql respectively. The command is as follows:
Start a docker instance
$ sudo docker run --name image_nick_name image_name:image_tag
Start mysql:
$ sudo docker run --name mysql -p 3400:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest
Start tomcat:
$ sudo docker run -it -d --name tomcat tomcat:latest
After startup, tomcat and mysql can be accessed successfully on the server
Connect to mysql:
$ mysql -u root -h 114.215.29.39 -P 3400 -p123456
Just visit ip: http://ip:10050/
This is the article about the installation and deployment example of docker on Linux. For more related installation and deployment content of docker on Linux, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!