Docker Offload هي ميزة تغير قواعد اللعبة من Docker تسمح للمطورين بالاستفادة من البنية التحتية السحابية للمهام كثيفة الاستخدام للموارد مع الحفاظ على تجربة تطوير محلية سلسة. تتعمق هذه المشاركة في تفاصيل Docker Offload، وتشرح ماهيتها، ولماذا يجب عليك استخدامها، وكيفية البدء. باستخدام Docker Offload، يمكن للمطورين تشغيل أعباء العمل الحسابية الثقيلة، والوصول إلى بيئات مدعومة بمعالج الرسومات (GPU)، وتسريع التطوير والاختبار دون أن تحد من قدرات جهازهم المحلي.
ما هو Docker Offload؟
Docker Offload هي خدمة مُدارة بالكامل تُمكّن من إنشاء Docker وتنفيذ الحاويات على البنية التحتية السحابية. يكمن جمالها في تكاملها الشفاف مع Docker Desktop. يواصل المطورون استخدام أوامر Docker المألوفة، بينما يقوم Docker Desktop بإنشاء نفق SSH آمن لخادم Docker يعمل في السحابة. يضمن هذا الإعداد بقاء تجربة التطوير محلية، بينما تتم العمليات الشاقة في السحابة.
- تشغيل عمليات إنشاء Docker والحاويات على البنية التحتية السحابية، مما يخفف العبء عن جهازك المحلي.
- يوفر تجربة تطوير محلية سلسة باستخدام أوامر Docker المألوفة.
- يستخدم نفق SSH آمنًا بين Docker Desktop وشيطان Docker المستند إلى السحابة.
لماذا تستخدم Docker Offload؟
يحل Docker Offload العديد من تحديات التطوير الشائعة:
- قيود الموارد: قم بتشغيل الحاويات التي تتطلب قوة حوسبة أو ذاكرة أكبر مما يمكن أن يوفره جهازك المحلي.
- عمليات الإنشاء الثقيلة: قم بتفريغ عمليات الإنشاء كثيفة الاستخدام للموارد إلى السحابة، مما يحرر جهازك المحلي لمهام أخرى.
- الوصول إلى وحدة معالجة الرسومات (GPU): احصل على وصول فوري إلى بيئات مدعومة بوحدة معالجة الرسومات لأحمال عمل الذكاء الاصطناعي والتعلم الآلي.
- التطوير المتسارع: تسريع التطوير والاختبار من خلال الاستفادة من موارد السحابة.
- البيئات المقيدة: قم بالتطوير بكفاءة حتى في البيئات المقيدة مثل البنى التحتية لسطح المكتب الظاهري (VDIs).
باختصار، يسد Docker Offload الفجوة بين سهولة التطوير المحلي وقابلية التوسع في السحابة.
البدء مع Docker Offload
لبدء استخدام Docker Offload، ستحتاج إلى ما يلي:
- Docker Desktop: الإصدار 4.43.0 أو أعلى.
- حساب Docker Hub مع حق الوصول إلى Offload: تحتاج إلى الاشتراك في برنامج تجريبي على https://www.docker.com/products/docker-offload/.
- اتصال الشبكة: تأكد من عدم وجود وكيل تقييدي أو جدار حماية يمنع حركة المرور إلى Docker Cloud.
بمجرد حصولك على حق الوصول، يمكنك تمكين Docker Offload إما من خلال واجهة Docker Desktop أو عبر سطر الأوامر:
التمكين عبر Docker Desktop: يتيح لك زر التبديل داخل Docker Desktop إمكانية تشغيل وإيقاف Docker Offload بسهولة. عند التمكين، تتحول واجهة Docker Desktop إلى اللون الأرجواني وتعرض رمز سحابة، مما يشير إلى اتصال ناجح بالبيئة السحابية.
التمكين عبر Terminal: استخدم الأمر docker offload start في جهازك الطرفي. سيطالبك الأمر بتحديد حساب Docker Hub الخاص بك وما إذا كنت تحتاج إلى دعم وحدة معالجة الرسومات.
بعد التمكين، ستظهر رسالة “تم إنشاء سياق Docker جديد: docker-cloud”، وسيتغير لون Docker Desktop الخاص بك.
ملاحظة: تمنح Docker 300 دقيقة مجانية لوحدة معالجة الرسومات للبدء! بعد انتهاء صلاحية الرصيد، يتم تسعير الاستخدام بسعر 0.015 دولارًا للدقيقة الواحدة لوحدة معالجة الرسومات.
تشغيل وإنشاء الحاويات باستخدام Docker Offload
للتحقق من أن Docker Offload قيد التشغيل، قم بتنفيذ الأمر docker offload status في جهازك الطرفي. يمكنك أيضًا التحقق من وجود رمز السحابة مع عبارة “Offload + GPU running” في الجزء السفلي الأيسر من نافذة Docker Desktop الخاصة بك.
يشبه إنشاء وتشغيل الحاويات باستخدام Docker Offload العملية القياسية: يمكنك استخدام أوامر Docker المألوفة مثل docker build و docker run. والفرق هو أن الإنشاء والتنفيذ يحدثان على البنية التحتية السحابية.
بالنسبة للتطبيقات المسرعة بوحدة معالجة الرسومات، استخدم العلامة --gpus all في أمر docker run الخاص بك:
docker run --rm --gpus all -p 3000:3000 docker-offload-demo
إيقاف Docker Offload
يمكنك إيقاف Docker Offload باستخدام زر التبديل في Docker Desktop أو عن طريق تشغيل الأمر docker offload stop في جهازك الطرفي.
خاتمة
يمثل Docker Offload خطوة كبيرة إلى الأمام في تبسيط سير عمل التطوير. من خلال دمج موارد السحابة بسلاسة في بيئة التطوير المحلية، يمكّن Docker Offload المطورين من معالجة المهام كثيفة الاستخدام للموارد بسهولة. هذه الميزة مفيدة بشكل خاص لتطوير الذكاء الاصطناعي-التعلم الآلي ومعالجة البيانات وأي سيناريو تعيق فيه قيود الجهاز المحلي الإنتاجية. جرب Docker Offload وافتح قوة قابلية التوسع في السحابة دون التضحية براحة التطوير المحلي.
المصدر: DZone
Docker Offload is a game-changing feature from Docker that allows developers to leverage cloud infrastructure for resource-intensive tasks while maintaining a seamless local development experience. This post dives into the details of Docker Offload, explaining what it is, why you should use it, and how to get started. With Docker Offload, developers can run compute-heavy workloads, access GPU-powered environments, and accelerate development and testing without being limited by their local machine’s capabilities.
What is Docker Offload?
Docker Offload is a fully managed service that enables Docker builds and container execution on cloud infrastructure. The beauty of it lies in its transparent integration with Docker Desktop. Developers continue to use familiar Docker commands, while Docker Desktop creates a secure SSH tunnel to a Docker daemon running in the cloud. This setup ensures that the development experience remains local, while the heavy lifting happens in the cloud.
- Runs Docker builds and containers on cloud infrastructure, relieving your local machine.
- Provides a seamless local development experience using familiar Docker commands.
- Utilizes a secure SSH tunnel between Docker Desktop and a cloud-based Docker daemon.
Why Use Docker Offload?
Docker Offload solves several common development challenges:
- Resource Constraints: Run containers that require more compute power or memory than your local machine can provide.
- Heavy Builds: Offload resource-intensive build processes to the cloud, freeing up your local machine for other tasks.
- GPU Access: Gain instant access to GPU-powered environments for AI and machine learning workloads.
- Accelerated Development: Speed up development and testing by leveraging cloud resources.
- Restricted Environments: Develop efficiently even in restricted environments such as Virtual Desktop Infrastructures (VDIs).
In essence, Docker Offload bridges the gap between the convenience of local development and the scalability of the cloud.
Getting Started with Docker Offload
To start using Docker Offload, you’ll need the following:
- Docker Desktop: Version 4.43.0 or higher.
- Docker Hub Account with Offload Access: You need to sign up for the beta program at https://www.docker.com/products/docker-offload/.
- Network Connectivity: Ensure no restrictive proxy or firewall blocks traffic to Docker Cloud.
Once you have access, you can enable Docker Offload either through the Docker Desktop interface or via the command line:
Enabling via Docker Desktop: A toggle button within Docker Desktop allows you to easily switch Docker Offload on and off. When enabled, the Docker Desktop interface turns purple and displays a cloud icon, indicating a successful connection to the cloud environment.
Enabling via Terminal: Use the docker offload start command in your terminal. The command will prompt you to select your Docker Hub account and whether you require GPU support.
After enabling, a “New Docker context created: docker-cloud” message will appear, and your Docker Desktop will change color.
Note: Docker is giving 300 free GPU minutes to get started! After credits expire, usage is priced at $0.015 per GPU minute.
Running and Building Containers with Docker Offload
To verify that Docker Offload is running, execute the docker offload status command in your terminal. You can also check for the cloud icon with “Offload + GPU running” at the bottom left of your Docker Desktop window.
Building and running containers with Docker Offload is similar to the standard process: you use familiar Docker commands like docker build and docker run. The difference is that the build and execution occur on cloud infrastructure.
For GPU-accelerated applications, use the --gpus all flag in your docker run command:
docker run --rm --gpus all -p 3000:3000 docker-offload-demo
Stopping Docker Offload
You can stop Docker Offload using the toggle button in Docker Desktop or by running the docker offload stop command in your terminal.
Conclusion
Docker Offload represents a significant step forward in streamlining the development workflow. By seamlessly integrating cloud resources into the local development environment, Docker Offload empowers developers to tackle resource-intensive tasks with ease. This feature is particularly beneficial for AI-ML development, data processing, and any scenario where local machine limitations hinder productivity. Give Docker Offload a try and unlock the power of cloud scalability without sacrificing the convenience of local development.
Source: DZone
جاري تحميل التعليقات...