0Pricing
Docker & Kubernetes for Developers · درس

تشغيل الحاوية الأولى

انشروا تطبيقًا بسيطًا باستخدام صورة Docker مُنشأة مسبقًا، وتفاعلوا معه عبر سطر الأوامر.

تشغيل الحاوية الأولى درس مجاني في Docker & Kubernetes for Developers على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Docker & Kubernetes for Developers، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Docker & Kubernetes for Developers 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Getting Started with Containers

Time to run real containers. You'll launch apps from images, interact with them, and learn the commands that manage their lifecycle.

Launching Containers with 'docker run'

docker run is your launch button: it checks for the image (pulling if needed), creates a container from it, and starts it — all in one command.

Your First Container: Hello World

Run the simplest container there is: hello-world. It prints a message and exits. Try it below.

docker run hello-world

What Just Happened?

Behind that hello-world run, Docker pulled the image, created a container, ran its command, printed the greeting, then stopped. A clean first cycle.

Interacting with Containers

To work inside a container, combine the -it flags: -i keeps STDIN open and -t gives you a terminal, so you can type commands inside it.

Get a Shell in Alpine Linux

Spin up minimal Alpine Linux and drop into its shell to run real Linux commands. Type exit to leave the container.

docker run -it alpine sh

Backgrounding with '-d'

To keep a container running without locking your terminal, use detached mode with the -d flag. Docker prints the container ID and hands control back.

Connecting with Port Mapping

Containers are isolated, so reach a service inside one with port mapping. The -p flag maps a host port to a container port: host:container.

Launching Nginx in Detached Mode

Combine detached mode and port mapping to run Nginx in the background, mapping your host's 8080 to the container's port 80. See the command below.

docker run -d -p 8080:80 nginx

Stopping & Removing Containers

Clean up when you're done: docker stop halts a running container and docker rm removes a stopped one. Grab the ID from docker ps first.

# First, find your Nginx container ID:
docker ps

# Then, stop it:
docker stop <your_nginx_container_id>

# Finally, remove it:
docker rm <your_nginx_container_id>

Quick Check: Interactive Mode

You want to run a container and immediately get a shell inside it to execute commands. Which option would you use with docker run?

Lesson Recap: Running Containers

Recap: docker run launches containers; -it gives a shell, -d runs detached, -p maps ports — plus stop and rm to clean up afterward.

الأسئلة الشائعة

هل درس «تشغيل الحاوية الأولى» مجاني؟

نعم — نص درس «تشغيل الحاوية الأولى» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Docker & Kubernetes for Developers، انتقل إلى CoddyKit PRO. تتضمن دورة Docker & Kubernetes for Developers 4 دروس في المجموع.

ماذا ستتعلم في «تشغيل الحاوية الأولى»؟

انشروا تطبيقًا بسيطًا باستخدام صورة Docker مُنشأة مسبقًا، وتفاعلوا معه عبر سطر الأوامر. تتمرن على Docker & Kubernetes for Developers مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Docker & Kubernetes for Developers؟

لا تُشترط خبرة سابقة. Docker & Kubernetes for Developers على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.

كم من الوقت يستغرق درس «تشغيل الحاوية الأولى»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Docker & Kubernetes for Developers هذا؟

نعم. كل درس في Docker & Kubernetes for Developers يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. مقدمة إلى الحاويات
  2. تثبيت Docker والأوامر الأساسية
  3. تشغيل الحاوية الأولى
  4. إدارة صور Docker والحاويات
← العودة إلى Docker & Kubernetes for Developers