मैं केवल दो फ़ाइलों, Dockerfile
और sayhello.sh
युक्त एक निर्देशिका है:कैसे एक अल्पाइन डोकर कंटेनर में एक bash स्क्रिप्ट चलाने के लिए
.
├── Dockerfile
└── sayhello.sh
Dockerfile
पढ़ता
FROM alpine
COPY sayhello.sh sayhello.sh
CMD ["sayhello.sh"]
और sayhello.sh
बस शामिल
echo hello
Dockerfile
सफलतापूर्वक बनाता है:
[email protected] ~/d/s/trybash> docker build --tag trybash .
Sending build context to Docker daemon 3.072 kB
Step 1/3 : FROM alpine
---> 665ffb03bfae
Step 2/3 : COPY sayhello.sh sayhello.sh
---> Using cache
---> fe41f2497715
Step 3/3 : CMD sayhello.sh
---> Using cache
---> dfcc26c78541
Successfully built dfcc26c78541
हालांकि, अगर मैं run
करने की कोशिश यह मैं एक executable file not found in $PATH
त्रुटि मिलती है:
[email protected] ~/d/s/trybash> docker run trybash
container_linux.go:247: starting container process caused "exec: \"sayhello.sh\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"sayhello.sh\": executable file not found in $PATH".
ERRO[0001] error getting events from daemon: net/http: request canceled
कोई व्याख्या कर सकते हैं कि इसका क्या कारण है? (मुझे debian:jessie
-आधारित छवियों में समान स्क्रिप्ट में चलने वाली स्क्रिप्ट याद आती हैं, तो शायद यह अल्पाइन-विशिष्ट है)?
डॉकरफ़ाइल में अनुदान निष्पादन अनुमति की आवश्यकता नहीं है यदि उसे पहले से ही अनुमति है – aerokite