你以为 Alpine 镜像想用就能用?
你以为 Alpine 镜像想用就能用?🌚 1 大致流程 alpine 镜像体积只有 5MB,作为 Docker 下最小的 Linux 镜像,很适合打造一些轻量级镜像。但 alpine 底层使用 musl-libc,兼容性与 glibc 有一定差距。 用 Golang 编写了一个简单的 hello, world 程序, Dockerfile 使用 alpine 作为基础镜像 FROM alpine:latest 能够正常运行; 基于 Gin 框架 Web 应用,相似的 Dockerfile 文件,build 完成后 run 的时候报了一些不明原因的错误,最后基础镜像改为 centos 或 alpine-glibc 后 ( FROM centos:latest ) 重新构建的镜像可以正常运行。 2 问题复现 2.1 使用 alpine 作为基础镜像构建 Golang “hello, world” 应用, ENTRYPOINT 使用 sh 运行程序 2.1.1 编写 “hello, world” Dockerfile,基础镜像 alpine hello.go package main import ( "fmt" "os" "flag" ) var config = flag.String("config", "go & docker", "[-config value]") func