简体   繁体   English

docker FILE的理解

[英]Understanding of docker FILE

I am using nodejs 11 with alpine on my servers using FROM node:11-alpine line.我使用FROM node:11-alpine行在我的服务器上使用 nodejs 11 和 alpine。 so by this, i understand it uses nodejs 11 version but what about alpine version?所以通过这个,我知道它使用 nodejs 11 版本但是高山版本呢? I checked manually on the server it uses alpine version 3.9 but what if I want to change the alpine version number?我在服务器上手动检查它使用 alpine 3.9 版但是如果我想更改 alpine 版本号怎么办?

One solution I know, buy creating own layer like我知道的一种解决方案是购买创建自己的图层

FROM alpine:{version}

ENV NODE_VERSION 11

then installing nodejs

I just want to understand can I do it bypassing the version number of alpine too in FROM node:11-alpine我只是想了解我是否可以在FROM node:11-alpine中绕过 alpine 的版本号

When you type FROM in a docker file it will look for an image with that name.当您在 docker 文件中键入 FROM 时,它将查找具有该名称的图像。 Images can contain any configuration that anyone wants to include and it can be named however they want.图像可以包含任何人想要包含的任何配置,并且可以随意命名。

That being said there are many node images.也就是说有很多节点图像。 https://hub.docker.com/_/node https://hub.docker.com/_/节点

On this page there are many images of node on different versions of alpine.在这个页面上有许多不同版本的 alpine 上的节点图像。 If you can't find the image you want there then you might need to create your own configuration as you suggested.如果你在那里找不到你想要的图像,那么你可能需要按照你的建议创建你自己的配置。 You could make a node alpine base image yourself that you base all your app images off of.你可以自己制作一个 node alpine 基础镜像,你的所有应用程序镜像都以此为基础。

I hope you find what you are looking for.我希望你能找到你要找的东西。 I tend to build my image off debian and install the version of node that I want for that project.我倾向于从 debian 构建我的图像并安装我想要用于该项目的节点版本。 I have example of that at https://github.com/jensen/assistbot/blob/master/Dockerfile我在https://github.com/jensen/assistbot/blob/master/Dockerfile有这样的例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM