Docker installation and deployment example on Linux

Docker installation and deployment example on Linux

After reading the following article, you can deploy the project on the server. You don’t need to install tomcat, jdk, mysql and other servers locally. You can solve it with one click through docker.

Install Docker

$ apt install docker.io -y

If the resource cannot be found, you need to update the resource library. The command is:

$ sudo apt-get update && sudo apt-get upgrade

Check the Docker version

$ docker -v

For more Docker-related knowledge, please visit: https://www.docker.com/

Docker installs mysql

$ docker pull mysql

Install Tomcat on Docker

$ docker pull tomcat

Launch the instance

After docker pulls the above two container images, the image list can be obtained through the following command

$ docker images -a

You can see the two images that were pulled to the local computer. Next, start the tomcat and mysql instances respectively. The commands are 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, you can successfully access tomcat and mysql on the server
Connect to mysql:

$ mysql -u root -h 114.215.29.39 -P 3400 -p123456

Access ip: http://ip:10050/

This is the end of this article about the installation and deployment examples of Docker on Linux. For more information about the installation and deployment of Docker on Linux, 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:
  • Install Docker environment in Linux environment (no pitfalls)
  • Steps to install MySQL using Docker under Linux
  • Golang study notes: Install Go1.15 version (win/linux/macos/docker installation)
  • Detailed explanation of how to install mongodb using docker on linux
  • The process of installing Docker in Linux system

<<:  Solution to the problem of invalid line-height setting in CSS

>>:  Solution to find all child rows for a given parent row in MySQL

Recommend

Example of how to increase swap in CentOS7 system

Preface Swap is a special file (or partition) loc...

WeChat Mini Programs Achieve Seamless Scrolling

This article example shares the specific code for...

Detailed tutorial on installing centos8 on VMware

CentOS official website address https://www.cento...

An example of how to write a big sun weather icon in pure CSS

Effect The effect diagram is as follows Implement...

MySQL 8.0.18 deployment and installation tutorial under Windows 7

1. Preliminary preparation (windows7+mysql-8.0.18...

Steps for packaging and configuring SVG components in Vue projects

I just joined a new company recently. After getti...

Vue implements div wheel zooming in and out

Implement div wheel zooming in and out in Vue pro...

How to print highlighted code in nodejs console

Preface When the code runs and an error occurs, w...

Vue template configuration and webstorm code format specification settings

Table of contents 1. Compiler code format specifi...

Detailed process of building mongodb and mysql with docker-compose

Let's take a look at the detailed method of b...

MySQL query optimization: causes and solutions for slow queries

Friends who are doing development, especially tho...

Solution to the problem that input in form cannot be submitted when disabled

I wrote a test program before, in which adding and...

What are inline elements and block elements?

1. Inline elements only occupy the width of the co...

This article will help you understand JavaScript variables and data types

Table of contents Preface: Kind tips: variable 1....