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

Instructions for using the database connection pool Druid

Replace it with the optimal database connection p...

Docker uses the Prune command to clean up the none image

Table of contents The creation and confusion of n...

Complete steps to install Anaconda3 in Ubuntu environment

Table of contents Introduction to Anaconda 1. Dow...

Detailed process of deploying Docker to WSL2 in IDEA

The local environment is Windows 10 + WSL2 (Ubunt...

How to implement call, apply and bind in native js

1. Implement call step: Set the function as a pro...

A Preliminary Study on Vue Unit Testing

Table of contents Preface Why introduce unit test...

Classes in TypeScript

Table of contents 1. Overview 2. Define a simple ...

HTML tutorial, understanding the optgroup element

Select the category selection. After testing, IE ...

Use of MySQL query rewrite plugin

Query Rewrite Plugin As of MySQL 5.7.6, MySQL Ser...

Two ways to understand CSS priority

Method 1: Adding values Let's go to MDN to se...

Use of Linux bzip2 command

1. Command Introduction bzip2 is used to compress...

Examples of clearfix and clear

This article mainly explains how to use clearfix a...

Example code for evenly distributing elements using css3 flex layout

This article mainly introduces how to evenly dist...