制作mips64el下hello-world基础镜像
*官方的hello-world镜像只有910B,官方github(https://github.com/docker-library/hello-world/tree/b7a78b7ccca62cc478919b101f3ab1334899df2b),
观其目录也只有四个文件。
Dockerfile
Makefile
hello
hello.asm #Intel x86 汇编
[Dockerfile]
FROM scratch #FROM 指出基于哪个镜像,scratch是一个空镜像,用于制作极小镜像。
ADD hello / #ADD表示将指定的文件添加到指定的目录
CMD ["/hello"] #CMD表示启动镜像时,执行的命令
[Makefile]
hello: hello.asm
nasm -o $@ $< #Makefile 语法"target:dependcy1 dependcy2" $@--目标文件target,$<--第一个依赖文件depency
chmod +x hello
.PHONY: clean #使用PHONY目标,避免同名文件相冲突,不会检查clean文件存在与否,都要执行清除操作
clean:
-rm -vf hello
*仿照写一个自己的hello-world
[root@localhost hello-world]# tree ./
./
├── Dockerfile
├── hello
├── hello.c
└── Makefile
Dockerfile文件
FROM fedora21-base
ADD hello /
CMD ["/hello"]
Makefile文件
hello:hello.c
gcc hello.c -o hello
.PHONY : clean
clean:
rm -f *.o
#docker build -t fc21/hello-world ;编译成docker镜像
#docker run fc21/hello-world ;启动这个镜像
<pre>