How to install Nginx in Docker

How to install Nginx in Docker

Install Nginx on Docker

Nginx is a high-performance HTTP and reverse proxy web server that also provides IMAP/POP3/SMTP services.

1. View available Nginx versions

Visit the Nginx image library address: https://hub.docker.com/_/nginx?tab=tags.

You can view other versions of Nginx by Sort by. The default is the latest version nginx:latest.

You can also find other versions you want in the drop-down list:

In addition, we can also use the docker search nginx command to view the available versions:

$ docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 3260 [OK]    
jwilder/nginx-proxy Automated Nginx reverse proxy for docker c... 674 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable ... 207 [OK]
million12/nginx-php Nginx + PHP-FPM 5.5, 5.6, 7.0 (NG), CentOS... 67 [OK]
maxexcloo/nginx-php Docker framework container with Nginx and ... 57 [OK]
...

2. Get the latest version of Nginx image

Here we pull the latest official version of the image:

$ docker pull nginx:latest 

3. View local image

Use the following command to check whether nginx is installed:

$ docker images 

In the above picture, you can see that we have installed the latest version of nginx image.

4. Run the container

After the installation is complete, we can run the nginx container with the following command:

$ docker run --name nginx-test -p 8080:80 -d nginx

Parameter Description:

--name nginx-test: container name.
-p 8080:80: Map the local port 8080 to port 80 inside the container.
-d nginx: Set the container to run in the background all the time.

5. Installation successful

Finally, we can directly access the nginx service on port 8080 through the browser:

The above is the details of how to install Nginx with Docker. For more information about installing Nginx with Docker, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • How to install and configure Docker nginx
  • How to install nginx in docker and configure access via https
  • Docker installation Nginx tutorial implementation illustration
  • Install Nginx and configure port forwarding using Docker

<<:  Detailed explanation of using Baidu style in eslint in React project

>>:  Vue3.0 implements encapsulation of checkbox components

Recommend

Share a Markdown editor based on Ace

I think editors are divided into two categories, ...

A brief analysis of mysql index

A database index is a data structure whose purpos...

Use ab tool to perform API stress test on the server

Table of contents 1 A brief introduction to syste...

Vue-Element-Admin integrates its own interface to realize login jump

1. First look at the request configuration file, ...

A brief discussion on Vue3 father-son value transfer

Table of contents From father to son: 1. In the s...

Sample code for JS album image shaking and enlarging display effect

The previous article introduced how to achieve a ...

Share the responsive frameworks commonly used by web design masters (summary)

This article introduces and shares the responsive...

MySQL 8.0.11 MSI version installation and configuration graphic tutorial

This article shares the installation and configur...

js to achieve a simple magnifying glass effect

This article shares the specific code of js to ac...

Detailed analysis of compiling and installing vsFTP 3.0.3

Vulnerability Details VSFTP is a set of FTP serve...

Problems with using multiple single quotes and triple quotes in MySQL concat

When dynamically concatenating strings, we often ...

Vuex modularization and namespaced example demonstration

1. Purpose: Make the code easier to maintain and ...

Method of Vue component document generation tool library

Table of contents Parsing .vue files Extract docu...