容器镜像服务 SWR-编写高效的Dockerfile:使用特定的标签

时间:2024-06-28 17:20:35

使用特定的标签

当镜像没有指定标签时,将默认使用latest标签。因此,FROM ubuntu指令等同于FROM ubuntu:latest。当镜像更新时,latest标签会指向不同的镜像,这时构建镜像有可能失败。

如下示例中使用16.04作为标签。

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y nodejs  
ADD . /app  
RUN cd /app && npm install

CMD npm start
support.huaweicloud.com/bestpractice-swr/swr_bestpractice_0002.html