创建 Dockerfile

1,创建一个简单的hello workd文件

 1 midke /root/hello-world
 2 cd /root/hello-world
 3 
 4 写一个helloworld脚本
 5 vim hello-world.py
 6 #!/usr/bin/env python
 7 print("hello world \n")
 8 
 9 vim Dockerfile
10 FROM python
11 ADD hello-world.py /
12 CMD ["python3","hello-world.py"]
13 
14 生成images
15 docker build -t python-obj/hello-world .
16 
17 查看生成的images
18 docker image ls
19 
20 运行images
21 docker run python-obj/hello-world 

猜你喜欢

转载自www.cnblogs.com/YingLai/p/10960451.html