Files
nexus/wiki/concepts/Dockerfile.md
2026-04-17 09:34:39 +08:00

792 B
Raw Blame History

title, type, tags, last_updated
title type tags last_updated
Dockerfile concept
docker
build
image
2026-04-17

Definition

Dockerfile 是用于构建 Docker 镜像的声明式配置文件,包含基础镜像选择、文件复制、命令执行等步骤。

基本语法

FROM <base_image>
USER root
RUN <command>
USER <non_root_user>

Common Instructions

  • FROM指定基础镜像
  • RUN执行命令
  • COPY复制文件
  • WORKDIR设置工作目录
  • USER切换用户
  • ENV设置环境变量
  • EXPOSE声明端口
  • CMD容器启动命令

Example

FROM n8nio/n8n:latest
USER root
RUN apk update && apk add --no-cache curl wget
USER node