如何製作Base Image

sudo gpasswd -a vagrant docker
重啓docker 進程
sudo service docker restart
docker pull hello-world
這hello-world也是個base image ,很小
運行這個容器
docker run hello-world
mkdir hello-world
cd hello-world
vim hello.c

#include<stdio.h>

int main()
{
printf("hello docker\n");
}
編譯c程序要先安裝
yum install gcc
yum install glibc-static
gcc -static hello.c -o hello
./hello
vim Dockerfile
FROM scratch
ADD hello /
CMD ["/hello"]
docker build -t skinglzw/hello-world . 構建bese image 完成
如何製作Base Image
docker image ls
ls -lh
docker history 3c082eba7935

docker run skinglzw/hello-world 這個base image 變成容器,運行這個容器

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章