English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Docker Install Nginx

Nginx is a high-performance HTTP and reverse proxy web server, which also provides IMAP/POP3/SMTP service .

1、view available Nginx versions

Visit the Nginx image repository 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 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]
...

2Pull the latest Nginx image

Here we pull the latest version of the official image:

$ docker pull nginx:latest

3Check local images

Use the following command to check if nginx has been installed:

$ docker images

As can be seen in the figure above, we have already installed the latest version (latest) of the nginx image.

4Run the container

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

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

Parameter Description:

  • --name nginx-test: Container name.

  • -p 8080:80: Map the port, map the local 808Port 0 mapped to the container's internal 8Port 0.

  • -d nginx: Set the container to run in the background continuously.

5Successfully installed

Finally, we can access it directly through the browser 808nginx service on port 0: