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

MySQL 8.0.12 Quick Installation Tutorial

The installation of MySQL 8.0.12 took two days an...

Vue folding display multi-line text component implementation code

Folding display multi-line text component Fold an...

Introduction to local components in Vue

In Vue, we can define (register) local components...

Three common ways to embed CSS in HTML documents

The following three methods are commonly used to d...

How to implement variable expression selector in Vue

Table of contents Defining the HTML structure Inp...

Implementation of Nginx Intranet Standalone Reverse Proxy

Table of contents 1 Nginx Installation 2 Configur...

HTML code that can make IE freeze

We simply need to open any text editor, copy the f...

Detailed explanation of the role of key in React

Table of contents Question: When the button is cl...

How to completely delete and uninstall MySQL in Windows 10

Preface This article introduces a tutorial on how...

Summary of the three stages of visual designer growth

Many people have read this book: "Grow as a ...

Analysis and Solution of ERROR:2002 Reported When MySQL Starts

Preface This article mainly introduces the analys...

Sample code for configuring nginx to support https

1. Introduction Are you still leaving your websit...