Docker Install Nginx
# Docker Install Nginx
Nginx is a high-performance HTTP and reverse proxy web server, which also provides IMAP/POP3/SMTP services.
### 1. Check Available Nginx Versions
Visit the Nginx image repository: [https://hub.docker.com/_/nginx?tab=tags](https://hub.docker.com/_/nginx?tab=tags).
You can view other versions of Nginx via Sort by. The default is the latest version **nginx:latest**.
[!(#)](#)
You can also find other versions you want in the dropdown list:
[!(#)](#)
Additionally, we can use the `docker search nginx` command to check available versions:
$ docker search nginx NAME DESCRIPTION STARS OFFICIAL AUTOMATED nginx Official build of Nginx. 3260 jwilder/nginx-proxy Automated Nginx reverse proxy for docker c... 674 richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable ... 207 million12/nginx-php Nginx + PHP-FPM 5.5, 5.6, 7.0 (NG), CentOS... 67 maxexcloo/nginx-php Docker framework container with Nginx and ... 57 ...
### 2. Pull the Latest Nginx Image
Here we pull the official latest version of the image:
$ docker pull nginx:latest
[!(#)](#)
### 3. Check Local Images
Use the following command to check if nginx is already installed:
$ docker images
[!(#)](#)
In the image above, we can see that we have installed the latest version (latest) of the nginx image.
### 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 Explanation:
* **--name nginx-test**: Container name.
* **-p 8080:80**: Port mapping, mapping the local port 8080 to the container's internal port 80.
* **-d nginx**: Sets the container to run in the background continuously.
[!(#)](#)
### 5. Installation Successful
Finally, we can access the nginx service on port 8080 directly through a browser:
[!(#)](#)
YouTip