Docker Install Nginx
Nginx is a high-performance HTTP and reverse proxy web server that also provides IMAP/POP3/SMTP services.
1. Check for available Nginx versions
Visit the Nginx mirror repository at https://hub.docker.com/_/nginx?tab=tags.
You can view other versions of Nginx by Sort by, which defaults to 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 see what versions are available.
$ 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. fetch the latest version of the Nginx image
Here we pull the official latest version of the image: ###
$ docker pull nginx:latest
3. Check the local image
Use the following command to see if nginx is installed.
$ docker images
In the image above, you can see that we have installed the latest (latest) version of the nginx image.
4. Running the container
Once the installation is complete, we can run the nginx container using the following command.
$ docker run --name nginx-test -p 8080:80 -d nginx
Parameter description.
- –name nginx-test: The name of the container.
- -p 8080:80: port to map, mapping local port 8080 to port 80 inside the container.
- -d nginx: Set the container to run in the background at all times.
Parameter description.
- –name nginx-test: The name of the container.
- -p 8080:80: port to map, mapping local port 8080 to port 80 inside the container.
- -d nginx: Set the container to run in the background at all times.