docker build သည် Dockerfile ကိုဖတ်ပြီး image အသစ်တစ်ခုတည်ဆောက်ပေးပါတယ်။ ဒီအဆင့်က ကိုယ်ရေးထားတဲ့ app ကို reusable image အဖြစ်ပြောင်းတဲ့အဆင့်ပါ။
dockerfile
# In the same directory as your Dockerfile
docker build -t my-custom-nginx:1.0 .
# Run the image as a container
docker run --name my-site -d -p 8080:80 my-custom-nginx:1.0
# Open http://localhost:8080 in your browser-t my-custom-nginx:1.0 က image ကို name နဲ့ tag ပေးတာပါ။ နောက်ဆုံးက . က build context ဖြစ်ပြီး လက်ရှိ folder ထဲက Dockerfile နဲ့လိုအပ်တဲ့ files တွေကို Docker build process ထဲပို့ပေးပါတယ်။
You should see
Build steps များပြီးဆုံးပါက my-custom-nginx:1.0 image ထွက်လာပြီး browser မှာ site ကိုကြည့်နိုင်ပါမယ်။Info
Build context ထဲမှာမလိုတဲ့ large files တွေများရင် build နှေးနိုင်ပါတယ်။ Real project မှာ .dockerignore file ထည့်ပြီး node_modules, logs, cache files များကို exclude လုပ်သင့်ပါတယ်။