---
# System prepended metadata

title: docker image的製作與測試

---

# docker image的製作與測試
---
os:ubuntu18.04
environment:python3.6,pip,docker
---
* 建立資料夾
* 建立Dockerfile
 ![](https://i.imgur.com/ZRI2rCO.png)
 第三行ADD後的. /app一定要空一格，否則無法執行
* 建立requiretments.txt讓docker知道要交付的檔案
![](https://i.imgur.com/nCmJ7zM.png)

* 做 app.py
![](https://i.imgur.com/nB6tZxy.png)

* `sudo docker build -t app .`
![](https://i.imgur.com/9pRCNxK.png)

* 用`sudo docker images`查看當前docker image的狀況
![](https://i.imgur.com/fkAwnrx.png)

* `sudo docker run -p 4000:80 app`
![](https://i.imgur.com/gDB5iB9.png)
* 用瀏覽器進去VM的server
![](https://i.imgur.com/KdrI4lU.png)
![](https://i.imgur.com/Ebr1Fjn.png)



