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

Writing a shell script in Ubuntu to start automatically at boot (recommended)

The purpose of writing scripts is to avoid having...

28 Famous Blog Redesign Examples

1. WebDesignerWall 2. Veerle's Blog 3. Tutori...

What does this.parentNode.parentNode (parent node of parent node) mean?

The parent node of the parent node, for example, t...

Div picture marquee seamless connection implementation code

Copy code The code is as follows: <html> &l...

Style trigger effect of web page input box

<br />This example mainly studies two parame...

A detailed introduction to HTML page loading and parsing process

The order in which the browser loads and renders H...

Implementation of fuzzy query like%% in MySQL

1, %: represents any 0 or more characters. It can...

js, css, html determine the various versions of the browser

Use regular expressions to determine the IE browse...

Several ways to solve CSS style conflicts (summary)

1. Refine the selector By using combinators, the ...

The difference between key and index in MySQL

Let's look at the code first: ALTER TABLE rep...

Display and hide HTML elements through display or visibility

Sometimes we need to control whether HTML elements...

How to deploy Angular project using Docker

There are two ways to deploy Angular projects wit...

What are Web Slices?

IE8 new feature Web Slices (Web Slices) Microsoft...