Docker परिचय
Tim Sangster
Software Engineer @ DataCamp
hello-world इमेज टेक्स्ट प्रिंट करती है और रुक जाती है.
docker run hello-world
Hello from Docker!
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon created a new container from the hello-world image which runs the
executable that produces the output you are currently reading.
3. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
python वाली इमेज स्टार्टअप पर python चला सकती है.
docker run python3-sandbox
Python 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
...
....
>>> exit()
repl@host:/#
CMD <shell-command>
CMD निर्देश:
ऐप्लिकेशन शुरू करना जो वर्कफ़्लो चलाए या बाहरी कनेक्शन स्वीकार करे.
CMD python3 my_pipeline.py
CMD postgres
ऐसा स्क्रिप्ट शुरू करना जो आगे कई ऐप्लिकेशन शुरू करे
CMD start.sh
CMD python3 start_pipeline.py
$$
$$
ज्यादा सामान्य इमेज को ज्यादा सामान्य स्टार्ट कमांड चाहिए.
इमेज शुरू करना
docker run <image>
कस्टम स्टार्ट कमांड के साथ इमेज शुरू करना
docker run <image> <shell-command>
कस्टम स्टार्ट कमांड के साथ इंटरैक्टिव मोड में इमेज शुरू करना
docker run -it <image> <shell-command>
docker run -it ubuntu bash
| उपयोग | Dockerfile निर्देश |
|---|---|
| कंटेनर इमेज से शुरू हो तो चलने वाला शेल कमांड जोड़ें. | CMD <shell-command> |
| उपयोग | शेल कमांड |
|---|---|
| इमेज में सेट CMD को ओवरराइड करें | docker run <image> <shell-command> |
| इमेज में सेट CMD को ओवरराइड करें और इंटरैक्टिव चलाएँ | docker run -it <image> <shell-command> |
Docker परिचय