一、编写hello可执行c文件:
1、安装:gcc glibc glibc-static
yum install -y gcc glibc glibc-static
2、编写hello.c:vim hello.c
#includeint main(){ printf("hello docker\n");}
3、编译
gcc -static hello.c -o hello
二、创建docker镜像:
1、创建Dockerfile,vim Dockerfile:
FROM scratchADD hello /CMD ["/hello"]
2、创建镜像:
docker build -t zhengchuzhou/hello-world .
3、测试:
docker run zhengchuzhou/hello-world