1
有沒有一種方法可以在發出docker run命令的終端中顯示回顯。如果沒有使用-d選項,這裏只顯示echo。我可以做碼頭日誌來查看這些回聲,但我想知道是否有方法讓他們直接在終端發出運行命令?Docker:用於運行Docker的終端的回顯圖像
Dockerfile:
# Generic Docker Image for Running Node app from Git Repository
FROM node:0.10.33-slim
ENV NODE_ENV production
# Add script to pull Node app from Git and run the app
COPY docker-node-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8080
CMD ["--help"]
入口點腳本:
#!/bin/bash
set -e
# Run the command passed in if it isn't to start a node app
if [ "$1" != 'node-server' ]; then
exec "[email protected]"
fi
# Logic for pulling the node app and starting it
cd /usr/src
# try to remove the repo if it already exists
rm -rf node-app; true
echo "Pulling Node app's source from $2"
git clone $2 node-app
cd node-app
# Check if we should be running a specific commit from the git repo
if [ ! -z "$3" ]; then
echo "Changing to commit $3"
git checkout $3
fi
npm install
echo "Starting the app"
exec node .