Amit Patil
Amit Patil

Reputation: 13

Run docker image inside AWS ECS EC2 Cluster

I created one AWS ECS cluster with launch type EC2. The cluster ec2 + windows based. I have to run docker image of java application inside this cluster. I created linux based docker image but it is not working in that windows cluster. I am getting below error : Status reason CannotPullContainerError: image operating system "linux" cannot be used on this platform

My docker file is :

FROM maven:3.6.1-jdk-8-alpine AS MAVEN_BUILD

COPY ./ ./

RUN mvn clean install -DskipTests

FROM openjdk:8

#VOLUME c:\Ctpl_VBA

ARG JAR_FILE=target/*.jar COPY --from=MAVEN_BUILD ${JAR_FILE} app.jar EXPOSE 8080 ENTRYPOINT ["java","-jar","/app.jar"]

Is there any way to run my java application using docker image inside AWS windows cluster?

Upvotes: 0

Views: 317

Answers (1)

mreferre
mreferre

Reputation: 6053

You can't run images based on a different OS than the one on the host. Containers aren't hw virtualization. They share the kernel with the host. If you are trying to re-use a Windows based cluster (that you are using for other Windows containers) to run a Linux container you should launch your Linux container with the Fargate launch type. Fargate is a fully managed compute engine to run containers without having to deploy EC2 capacity. For now it's only available for Linux containers and it may serve your need.

Upvotes: 0

Related Questions