Deploying a Docker Perl container for an elastic beanstalk

I am creating a Docker container that pulls a perl / mojolicious repo from bitbucket but I am having problems. I have a 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 

And, locally, after docker build -t name/project . he builds great and says "Successfully built."

I fixed it using the repo-key file and applied it to Elastic Beanstalk, I clicked on the Upload and Deploy button (I successfully deployed a sample game 2048 and tried to replicate it).

This is returned from Dockerrun.aws.json: No such file or directory . I think this is strange because the documentation says that Dockerfile or Dockerrun.aws.json can be used independently for different needs. But be that as it may, I gave him a short, hopefully insignificant, Dockerrun.aws.json, like this:

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

It still fails, and now the log says [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/04run.sh] command failed with error code 1: and then Docker container quit unexpectedly after launch .

Can someone help me fix these files?

+6
source share
1 answer

I get it. The problem was that hypnotoad works by default by default, and that instantly destroys the container. By adding the -f flag, it starts in the foreground and the container is saved. I also switched CMD to ENTRYPOINT .

 #... same as above except for last line WORKDIR project ENTRYPOINT [ "hypnotoad", "-f", "./script/project" ] 

You still have to feed EB both Dockerfile and Dockerrun.aws.json for no apparent reason, but even so, it works without errors.

+2
source

Source: https://habr.com/ru/post/985144/


All Articles