Docker မှာ အရေးကြီးဆုံး concept နှစ်ခုက Image နဲ့ Container ပါ။
• Image ဆိုတာ app တစ်ခုကို run ဖို့လိုတဲ့ file system, dependencies, instruction တွေပါဝင်တဲ့ read-only template ပါ။ Blueprint လိုစဉ်းစားနိုင်ပါတယ်။
• Container ဆိုတာ image ကိုအခြေခံပြီး တကယ် run နေတဲ့ instance ပါ။ Blueprint နဲ့ဆောက်ထားတဲ့အိမ်တစ်လုံးလိုပေါ့။ Image တစ်ခုတည်းကနေ container အများကြီး run နိုင်ပါတယ်။
# Pull the image first
docker pull nginx
# Create and run a container from that image
docker run --name my-nginx -d -p 8080:80 nginx
# Show running containers
docker psပထမ command က nginx image ကို local machine ထဲ download လုပ်ပါတယ်။ ဒုတိယ command က အဲဒီ image ကိုသုံးပြီး my-nginx ဆိုတဲ့ container တစ်ခု run လုပ်ပါတယ်။
docker ps ထဲမှာ my-nginx container running အဖြစ်မြင်ရပါမယ်။Info
Image က မပြောင်းလဲတဲ့ template ဖြစ်ပြီး container က run နေတဲ့ process ဖြစ်ပါတယ်။ Container ကိုဖျက်လိုက်လည်း image ကကျန်နေပါမယ်။