Deploying Docker to AWS Elastic Beanstalk: failed to execute command 'docker pull maven'
I figured it out so I will leave an answer for future readers. Turns out AWS doesn't allow you to use the AS
keyword in Docker. So I changed the file from:
# Build stage
#
FROM maven:3.8.1-jdk-8 AS build
ADD src /tmp/src
ADD pom.xml /tmp/pom.xml
RUN mvn -f /tmp/pom.xml clean package
#
# Package stage
#
FROM openjdk:8
COPY --from=build /tmp/target/my-project-host-0.0.1-SNAPSHOT.jar /usr/local/lib/my-project.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/local/lib/my-project.jar"]
To this:
# Build stage
#
FROM maven:3.8.1-jdk-8
ADD src /tmp/src
ADD pom.xml /tmp/pom.xml
RUN mvn -f /tmp/pom.xml clean package
#
# Package stage
#
FROM openjdk:8
COPY --from=0 /tmp/target/my-project-host-0.0.1-SNAPSHOT.jar /usr/local/lib/my-project.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/local/lib/my-project.jar"]
AWS Elastic Beanstalk - how to stop previous docker before starting new one
immutable updates can be the way to go for you, it basically recreates the EC2 instances completely on every deploy
- Open the Elastic Beanstalk console.
- Navigate to the management page for your environment.
- Choose Configuration.
- In the Rolling updates and deployments configuration category,
choose Modify. - Select immutable on deploy policy
- Apply
you can check more on how it works here
In elastic beanstalk, how do I run a command before the container is launched?
Either you replace the CMD/ENTRYPOINT
with a script where you run that inside the running docker container (runs each time you start the docker container), or you add this to .ebextensions/00-my-tasks.config
:
container_commands:
00-my-task:
command: rake db:migrate
Then it runs in the elastic-beanstalk container/virtual machine, but outside of docker container.
Related Topics
Change Default Console Loglevel During Boot Up
How to Compile Simple C Program in Linux Mint 15
How to Write Integer to Binary File Using Bash
How to Count the Number of Characters in a Bash Variable
What Does It Mean to Say "Linux Kernel Is Preemptive"
Why Does Ps O/P List the Grep Process After the Pipe
Cmake_Prefix_Path Doesn't Help Cmake in Finding Qt5
Execute Shell Commands from Program Running in Wine
Which Drivers Are Used by Usb Mouse in Linux Kernel
Best Way to Monitor File System Changes in Linux
Reliability of Linux Kernel Add_Timer at Resolution of One Jiffy
Finding Process Count in Linux via Command Line
How to Record What Process or Kernel Activity Is Using the Disk in Gnu/Linux
Sending Keyboard Input to a Program from Command-Line
Weird Sigsegv Segmentation Fault in Std::String::Assign() Method from Libstdc++.So.6
How to Reinstall the Latest Cmake Version
Is There an Equivalent to Com on *Nix Systems ? If Not, What Was the *Nix Approach to Re-Usability