Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Docker install Nginx

Docker install Nginx

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

1. Check available Nginx versions

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

You can use Sort by to view other versions of Nginx; 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 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]

...

2. Get the latest Nginx image

Here we pull the official latest-version image:

$ docker pull nginx:latest

3. View local images

Use the following command to check whether nginx is installed:

$ docker images

In the figure above we can see that we have installed the nginx image of the latest version (latest).

4. Run the container

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

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

Parameter Description:

5. Installation successful

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