Build-time proxy credentials को Docker images से बाहर रखें
Docker के पूर्वनिर्धारित build proxy inputs का समझदारी से उपयोग करें और अस्थायी proxy secrets को image के स्थायी environment values में न बदलें।
Build के दौरान packages डाउनलोड करने के लिए Dockerfile के ENV में अस्थायी route सहेजने के बजाय Docker के predefined proxy inputs इस्तेमाल करें। 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 .Documentation endpoint बदलें। --build-arg नामों के बाद values छोड़ने पर वे इसी invocation के environment से ली जाती हैं। इन predefined inputs के लिए ARG declarations आवश्यक नहीं हैं।
Docker डिफ़ॉल्ट रूप से इन proxy arguments को build-cache handling और docker history से बाहर रखता है। Dockerfile में स्पष्ट reference करने से व्यवहार बदलता है; केवल किसी दूसरे उदाहरण की नकल में declarations न जोड़ें।
Process को values फिर भी मिलती हैं। Authenticated URL printed environment, logs, copied config या बाद के image operations से लीक हो सकता है। Dockerfile का ENV route को final image environment का हिस्सा बनाता है।
Sensitive material चाहिए तो BuildKit secret mount build-time secret interface देता है। Credential को उसी operation तक सीमित रखें; mount को print या image layer में copy न करें।
ये build inputs daemon के पहले किए गए registry pull या unreachable remote builder के host route को configure नहीं करते। बाद में final image और application config में persistent proxy values जाँचें।