2016-08-10 99 views
1

這裏是我的Dockerfile:泊塢窗集裝箱命令無法找到shell腳本

FROM debian 

MAINTAINER Andrew Ford<[email protected]> 
RUN apt-get update 
COPY entrypoint.sh/

ENTRYPOINT ["/entrypoint.sh"] 

,這裏是我的entrypoint.sh(同一目錄Dockerfile)

#!/bin/bash 

echo Hello 

然後我跑:

docker build --no-cache=true -t test/dockerfile-sayhello . 

當我跑步時:

docker run test/dockerfile-sayhello 

返回:

C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: Container command '/entrypoint.sh' not found or does not exist.. 

我曾嘗試google搜索周圍嘗試,看看我所做的任何明顯的錯誤,但到目前爲止,我還沒有能夠識別它。也許你們中的一些可以幫助

編輯:也跑了使用chmod + X entrypoint.sh賦予權限

+0

什麼'docker run test/dockerfile-sayhello ls -l/entrypoint'輸出?你的腳本文件是否有unix行結尾? – Matt

+0

它返回相同的東西,是的,它確實有unix行結尾 – paperpin

+0

嘗試使用'。/ entrypoint.sh'。 –

回答

0

我只是想用下面的Dockerfile(加入chmod

FROM debian 

MAINTAINER Andrew Ford<[email protected]> 
RUN apt-get update 
COPY entrypoint.sh/

RUN chmod 755 /entrypoint.sh 

ENTRYPOINT ["/entrypoint.sh"] 

而且它作爲預期。


它不像issue 20789

我試圖從PHUSION/baseimage變換Dockerfile設置到gliderslabs /高山。結果發現那些shell腳本使用bash - 當然!簡單地更改爲sh,爲bash不存在,從而導致上述錯誤..

最新debian image應包括bash的,因爲它的默認CMD/bin/bash

相關問題