我尝试使用入口点和 cmd 设置 Docker。
FROM debian:stretch
RUN apt-get update && \
apt install gnupg ca-certificates -y
RUN echo "deb http://repo.aptly.info/ squeeze main" > /etc/apt/sources.list.d/aptly.list
RUN apt-key adv --keyserver keys.gnupg.net --recv-keys 9E3E53F19C7DE460
RUN apt update && apt install aptly -y
ADD aptly.conf /etc/aptly.conf
ADD start.sh .
VOLUME ["/aptly"]
ENTRYPOINT ["/start.sh"]
CMD ["aptly", "api", "serve"]
但是入口点脚本没有停止...... cmd 命令没有启动
这是我的脚本:
#!/bin/bash
set -e
init_aptly() {
#import pgp key
#create nginx root folder in /aptly
su -c "mkdir -p /aptly/.aptly/public"
echo "12"
#initialize repository
#aptly create repo doze-server - distribution="stable"
}
#check for first run
if [ ! -e /aptly/.aptly/public ]; then
init_aptly
echo "13"
fi
echo "14"
脚本总是回显 14,我只想要一个,然后从 dockerfile 执行 cmd 命令