Node.js apt get安装-y nginx及更新版本
在Dockerfile中:Node.js apt get安装-y nginx及更新版本,node.js,docker,nginx,apt-get,Node.js,Docker,Nginx,Apt Get,在Dockerfile中: FROM node:8 RUN apt-get update && apt-get install -y \ nginx 我想我用这种方式得到了一个非常旧的nginx版本。如何安装更新的版本,如1.15.7? 我可以做一些类似于: FROM node:8 RUN apt-get update && apt-get install -y \ curl \ # Where to download the nginx sourc
FROM node:8
RUN apt-get update && apt-get install -y \
nginx
我想我用这种方式得到了一个非常旧的nginx版本。如何安装更新的版本,如1.15.7?
我可以做一些类似于:
FROM node:8
RUN apt-get update && apt-get install -y \
curl \
# Where to download the nginx source? Pass the download path below
&& curl -sL \
&& apt-get install -y nginx
如果您想使用具有特定版本的
apt-get
安装软件包,您可以:
安装版本
Re(注释)选项1:从其主线存储库安装Nginx:
您需要安装密钥,以便Ubuntu信任该存储库中的软件包。
cd /tmp/ && wget http://nginx.org/keys/nginx_signing.key
sudo sh -c "echo 'deb http://nginx.org/packages/mainline/ubuntu/ '$(lsb_release -cs)' nginx' > /etc/apt/sources.list.d/Nginx.list"
sudo apt-get update
sudo apt-get install nginx
添加密钥后,运行以下命令在Ubuntu上安装Nginx的主线存储库或分支。
cd /tmp/ && wget http://nginx.org/keys/nginx_signing.key
sudo sh -c "echo 'deb http://nginx.org/packages/mainline/ubuntu/ '$(lsb_release -cs)' nginx' > /etc/apt/sources.list.d/Nginx.list"
sudo apt-get update
sudo apt-get install nginx
Re(注释)选项2:从其稳定存储库安装Nginx:
节点:8使用debian stretch,因此
1.在文本编辑器中打开/etc/apt/sources.list,并在底部添加以下行:
deb http://nginx.org/packages/mainline/debian/ stretch nginx
它说找不到“nginx”的版本“1.15.*”。它只适用于
nginx=1.10.3-1+deb9u2
,这是一个旧的、损坏的版本。
deb http://nginx.org/packages/mainline/debian/ stretch nginx
sudo wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
sudo apt update
sudo apt install nginx