docker linux/X86 hello Example, build "FROM scratch "

99 篇文章 0 订阅
13 篇文章 0 订阅


lake@localhost:~/local/test-linux-docker-lake/myhello/build$ gcc -static hello.c -o hello

Instead of static link, a raw system call hello world print version is here:

https://raw.githubusercontent.com/docker-library/hello-world/master/hello.c


lake@localhost:~/local/test-linux-docker-lake/myhello/build$ cd  ..
lake@localhost:~/local/test-linux-docker-lake/myhello$ ls -l
total 12
-rw-r--r-- 1 jhula sudo   40 Dec  9 23:41 Dockerfile
drwxr-xr-x 2 jhula sudo 4096 Dec  9 23:53 build
lrwxrwxrwx 1 jhula sudo   11 Dec  9 23:48 hello -> build/hello
-rw-r--r-- 1 jhula sudo 1044 Dec  9 23:54 readme.txt


lake@localhost:~/local/test-linux-docker-lake/myhello$ cat Dockerfile
FROM scratch   <<<<< Base  Image !!!
ADD hello /
CMD ["/hello"]
 

lake@localhost:~/local/test-linux-docker-lake/myhello$ docker build --tag hello  .
Sending build context to Docker daemon  917.5kB
Step 1/3 : FROM scratch
 --->
Step 2/3 : ADD hello /
 ---> ca639f6465b4
Step 3/3 : CMD ["/hello"]
 ---> Running in d0e4458fdf32
Removing intermediate container d0e4458fdf32
 ---> 92c78963cad5
Successfully built 92c78963cad5
Successfully tagged hello:latest
lake@localhost:~/local/test-linux-docker-lake/myhello$ docker  images
REPOSITORY                                                TAG                 IMAGE ID            CREATED             SIZE
hello                                                     latest              92c78963cad5        8 seconds ago       913kB

lake@localhost:~/local/test-linux-docker-lake/myhello$  docker run     hello
Hello


### dock image file
lake@localhost:~/local/test-linux-docker-lake/myhello$ sudo  find /var/lib/docker  -name  92c78963cad5*
/var/lib/docker/image/aufs/imagedb/metadata/sha256/92c78963cad51a2e845dfb858a570d4909c7212241065e1243cfeb4f7a2ef615
/var/lib/docker/image/aufs/imagedb/content/sha256/92c78963cad51a2e845dfb858a570d4909c7212241065e1243cfeb4f7a2ef615

~
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值