# 1. use ubuntu 16.04 as base image
FROM ubuntu:16.04
# defining user root
USER root
# OS update
RUN apt-get update
# Installing PHP and NginX
RUN apt-get install -y nginx=1.4.* php7.0
# Remove the default Nginx configuration file
RUN rm -v /etc/nginx/nginx.conf
# Copy a configuration file from the current directory
ADD nginx.conf /etc/nginx/
ADD web /usr/share/nginx/html/
# Append "daemon off;" to the beginning of the configuration
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Expose ports
EXPOSE 90
# Set the default command to execute
# when creating a new container
CMD service nginx start
This is my Dockerfile. I want to Install 1.14.2 of Nginx but Error occurs:
E: Version '1.4.*' for 'nginx' was not found.
How can I install specific version of nginx inside docker this way?
As pointed out by @larsks Ubuntu 16.04
supports nginx only till version 1.10.3
Official wiki with more detail
So best/safe option would be either move your base OS to 18.04
or use nginx 1.10.3
Just for reference how you can install Nginx from src.
wget https://nginx.org/download/nginx-1.14.0.tar.gz
tar zxf nginx-1.14.0.tar.gz
cd nginx-1.14.0
make
sudo make install
sudo nginx
More detail here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With