如何创建一个image
如何diy一个image?
1
mkdir hello-world
2
vim hello.c
3,编写代码并保存
#include<stdio.h>
int main(){
printf("hello docker\n");
}
4,安装两个工具
yum install -y gcc glibc-static
5,输入一个可执行文件
gcc -static hello.c -o hello
这是一个可执行文件,./hello
会输出 hello docker
6,创建一个Dockerfile文件
FROM scratch
ADD hello /
CMD ["/hello"]
7,创建
docker build -t fangshuai/hello-world .
8,测试
docker run fangshuai/hello-world
结果如下:
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: