git – 将Perl Docker容器部署到Elastic Beanstalk

前端之家收集整理的这篇文章主要介绍了git – 将Perl Docker容器部署到Elastic Beanstalk前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在构建一个Docker容器,它从bitbucket中提取perl / mojolicIoUs repo,但我遇到了问题.我有这样的Dockerfile:

# DOCKER-VERSION 0.3.4
FROM        perl:latest
MAINTAINER  My Name myname@name.com

# Update aptitude with new repo
RUN apt-get update

# Install software 
RUN apt-get install -y git
# Make ssh dir
RUN mkdir /root/.ssh/

# Copy over private key,and set permissions
ADD repo-key /root/.ssh/id_rsa

# Create known_hosts
RUN touch /root/.ssh/known_hosts
# Add bitbuckets key
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts

RUN curl -L http://cpanmin.us | perl - App::cpanminus
RUN cpanm MojolicIoUs

RUN cachebuster=b953b35 git clone -b branch git@bitbucket.org:org/project.git

EXPOSE 8080

WORKDIR project
CMD hypnotoad script/project
@H_403_8@

并且,在本地,在docker build -t name / project上.它建立得很好,并说“成功建立.”

我用repo-key文件将其压缩并将其提供给Elastic Beanstalk,我点击了Upload and Deploy(我成功部署了2048游戏样本,并尝试复制它).

这与Dockerrun.aws.json一起回来:没有这样的文件或目录.我认为这很奇怪,因为文档说Dockerfile或Dockerrun.aws.json可以独立用于不同的需求.但无论如何,我给了它一个简短的,希望无关紧要的Dockerrun.aws.json,就像这样:

{
    "AWSEBDockerrunVersion": "1","Ports": [
        {"ContainerPort": "8080"}
    ],"Volumes": []
}
@H_403_8@

它仍然失败并且日志现在声明[CMD-AppDeploy / AppDeployStage0 / AppDeployPreHook / 04run.sh]命令失败,错误代码为1:并且在启动后,Docker容器进一步意外退出.

有人可以帮我解决这些文件吗?

最佳答案
我想到了.问题是催眠术默认在后台运行,这使容器立即死亡.通过添加-f标志,它在前台运行并且容器仍然存在.我还将CMD切换到ENTRYPOINT.

#... same as above except for last line

WORKDIR project
ENTRYPOINT [ "hypnotoad","-f","./script/project" ]
@H_403_8@

您仍然需要向Dock提供EB Dockerfile和Dockerrun.aws.json,但是即便如此,它也能正常运行.

猜你在找的Docker相关文章