多个docker容器弹性beanstalk

多个docker容器弹性beanstalk

我正在使用单个容器 Docker 在 Elastic Beanstalk 上运行 Play Scala 应用程序。问题是,如果我通过 SSH 进入我的实例并运行docker ps,我会看到以下内容:

CONTAINER ID        IMAGE                              COMMAND                CREATED             STATUS              PORTS               NAMES
b97459277e72        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   10 minutes ago      Up 10 minutes       9000/tcp            cranky_rosalind     
7ffa795d6810        3dfb5143a62a                       "/bin/sh -c 'rm -f R   13 minutes ago      Up 13 minutes       9000/tcp            serene_sinoussi     
bbf010d8f02d        3dfb5143a62a                       "/bin/sh -c 'rm -f R   14 minutes ago      Up 14 minutes       9000/tcp            fervent_hawking     
ec9c3d329d1d        3dfb5143a62a                       "/bin/sh -c 'rm -f R   15 minutes ago      Up 15 minutes       9000/tcp            insane_hypatia      
9ffa80f40fec        3dfb5143a62a                       "/bin/sh -c 'rm -f R   16 minutes ago      Up 16 minutes       9000/tcp            admiring_rosalind 

应该有那么多正在运行的容器吗?

难道不应该只有 1 个容器吗?

我的 Dockerfile 如下所示:

FROM java:openjdk-8-jre
MAINTAINER XXXX
EXPOSE 9000
ADD files /
WORKDIR /opt/docker
RUN ["chown", "-R", "daemon", "."]
USER daemon
ENTRYPOINT rm -f RUNNING_PID && bin/my-app -mem 1360 -DapplyEvolutions.default=true
CMD []

以下是docker ps使用相同 Dockerfile 的另一台服务器:

CONTAINER ID        IMAGE                              COMMAND                CREATED             STATUS              PORTS               NAMES
bf33b51b6d59        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   4 hours ago         Up 4 hours          9000/tcp            tender_leakey       
248664ebd789        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   4 hours ago         Up 4 hours          9000/tcp            pensive_lumiere     
99a143adff26        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   4 hours ago         Up 4 hours          9000/tcp            sad_poincare        
eb24ae106aed        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   4 hours ago         Up 4 hours          9000/tcp            loving_fermi        
724552fdb751        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   4 hours ago         Up 4 hours          9000/tcp            stoic_goldstine     
dd28117efa4a        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   4 hours ago         Up 4 hours          9000/tcp            sad_pare            
05c74f0fe25f        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   4 hours ago         Up 4 hours          9000/tcp            nostalgic_yonath    
cd1ae904efa6        aws_beanstalk/current-app:latest   "/bin/sh -c 'rm -f R   4 hours ago         Up 4 hours          9000/tcp            sad_hoover 

答案1

我认为你看到这么多的原因是它们无法启动和重新启动。我从未见过有人使用ENTRYPOINT cmd1 && cmd2

尝试将启动序列移到单独的start.sh脚本中,然后使用该脚本作为ENTRYPOINT替代。

相关内容