Build အချိန် proxy credential များကို Docker image များထဲ မထားပါနှင့်
Docker ၏ ကြိုတင်သတ်မှတ်ထားသော build proxy input များကို အသုံးပြုပြီး ယာယီ proxy လျှို့ဝှက်ချက်များကို image ၏ အမြဲတမ်း environment value များအဖြစ် မပြောင်းပါနှင့်။
Build အတွင်း package များ download လုပ်ရန် Dockerfile ၏ ENV ထဲတွင် ယာယီလမ်းကြောင်းသိမ်းမည့်အစား Docker ၏ ကြိုတင်သတ်မှတ်ထားသော proxy input များကို အသုံးပြုပါ။ POSIX invocation က အောက်ပါတို့ကို ပေးနိုင်သည်။
HTTP_PROXY=http://203.0.113.10:8080 \
HTTPS_PROXY=http://203.0.113.10:8080 \
docker build --build-arg HTTP_PROXY --build-arg HTTPS_PROXY .Document endpoint ကို အစားထိုးပါ။ --build-arg အမည်များနောက်က value များကို ချန်ထားပါက ဤ invocation ၏ environment မှ ယူသည်။ ဤကြိုတင်သတ်မှတ်ထားသော input များအတွက် ARG declaration မလိုပါ။
Docker သည် ဤ proxy argument များကို build-cache ကိုင်တွယ်မှုနှင့် docker history မှ ပုံမှန်အားဖြင့် ဖယ်ထားသည်။ Dockerfile ထဲတွင် တိုက်ရိုက်ရည်ညွှန်းပါက အပြုအမူပြောင်းသွားသည်။ အခြား build-argument ဥပမာက ထည့်ထားသည်ဟု ဆိုပြီး declaration မထည့်ပါနှင့်။
Process သည် value များကို ရနေဆဲဖြစ်သည်။ Authenticated URL သည် printed environment၊ logs၊ copied config သို့မဟုတ် နောက်ပိုင်း image operation များမှတစ်ဆင့် ပေါက်ကြားနိုင်သည်။ Dockerfile ၏ ENV သည် route ကို နောက်ဆုံး image environment ၏ အစိတ်အပိုင်းဖြစ်စေသည်။
Command တွင် sensitive material လိုပါက BuildKit secret mount ကို အသုံးပြုပါ။ Credential ကို ထို operation တွင်သာ ကန့်သတ်ထားပါ။ mount ကို print မလုပ်ပါနှင့်၊ ၎င်း၏ content ကို image layer ထဲ copy မလုပ်ပါနှင့်။
ဤ build input များသည် daemon ၏ အစောပိုင်း registry pull သို့မဟုတ် မရောက်နိုင်သော remote builder ၏ host route ကို configure မလုပ်ပါ။ နောက်ပိုင်း final image နှင့် application config တွင် persistent proxy value များ ရှိမရှိ စစ်ပါ။