自己动手做一个docker base images
创建一个文件hello.c
#include<stdio.h>
int main()
{
printf("hello world\n");
}
[root@localhost ~]# gcc -static hello.c -o hello --编译源代码
[root@localhost ~]# ls
anaconda-ks.cfg hello.c 模板 图片 下载 桌面
hello initial-setup-ks.cfg start.sh 公共 视频 文档 音乐
[root@localhost ~]# vim dockerfile ---手写一个dockerfile
[root@localhost ~]# docker build -t mydocker . --打镜像
Sending build context to Docker daemon 35.53 MB
Step 1/3 : FROM scratch
--->
Step 2/3 : ADD hello /
---> ffe73bcc5cd8
Removing intermediate container 7e5fefd387c6
Step 3/3 : CMD /hello
---> Running in 737481d324ce
---> 5176c09e8f32
Removing intermediate container 737481d324ce
Successfully built 5176c09e8f32
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mydocker latest 5176c09e8f32 14 seconds ago 865 kB
docker.io/hello-world latest bf756fb1ae65 7 months ago 13.3 kB
registry.aliyuncs.com/helowin/oracle_11g latest 3fa112fd3642 4 years ago 6.85 GB
[root@localhost ~]# docker run mydocker
hello world
浙公网安备 33010602011771号