node.js Dockerイメージを作成しました。 Dockerfile
の末尾にCMD node myapp.js
を使用して起動します。 しかし、CMD /root/start.sh
を使用すると失敗します。 、standard_init_linux.go:175: exec user process caused "no such file or directory"
は、しかし、私は理解していない :私が手docker logs
を使用しシェルスクリプトでノードアプリケーションを起動できません
FROM debian:latest
COPY config/start.sh /root/start.sh
RUN chmod +x /root/start.sh
WORKDIR /my/app/directory
RUN apt-get install -y wget && \
wget https://nodejs.org/dist/latest-v5.x/node-v5.12.0-linux-x64.tar.gz && \
tar -C /usr/local --strip-components 1 -xzf node-v5.12.0-linux-x64.tar.gz && \
rm -f node-v5.12.0-linux-x64.tar.gz && \
ln -s /usr/bin/nodejs /usr/bin/node
# works:
CMD node myapp.js
# doesn't work:
CMD /root/start.sh
:
#!/bin/bash
node myapp.js
そして、ここが重要な私のDockerfile
の線です:
は、これは私のstart.sh
がどのように見えるかですDockerfileにRUN ls /root
を追加すると、そのファイルが存在することがわかります。 スクリプト内でフルパスで試してみました。
#!/bin/bash
/usr/bin/node /my/app/directory/myapp.js
何も変更されていません。それでは、何が問題なのでしょうか?
あなたはどのイメージをビルドしていますか? – Matt
@Matt:Dockerfile – Munchkin
'/ usr/local/bin/node'にいくつかのエントリを追加しましたか? – Matt