티스토리 뷰

반응형

 

평소와 다름없이 로컬에서 docker 빌드 후 ECR에 올려 ECS로 배포를 했는데 계속 죽길래

클라우드 와치에서 로그를 확인해봤다.

exec /bin/sh: exec format error

포맷 에러요?

 

유일하게 바뀐 환경은 노트북이 m2라는 것인데 (기존에는 인텔)

이때는 빌드할때만 한 가지 옵션을 더 주면 된다.

 

 

 

기존에 아래와 같이 도커 이미지를 빌드 했다면

% aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 1234567890123.dkr.ecr.ap-northeast-2.amazonaws.com
% docker build -t apis --build-arg profile=dev .
[+] Building 5.4s (10/10) FINISHED                                                                                                                                                                                       
 => [internal] load build definition from Dockerfile                                                                                                                                                                0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/openjdk:8-jre-alpine                                                                                                                                             1.9s
 => [internal] load build context                                                                                                                                                                                   0.5s
 => => transferring context: 65.85MB                                                                                                                                                                                0.5s
 => CACHED [1/5] FROM docker.io/library/openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193                                                                                0.0s
 => [2/5] ADD ./build/libs/apis-0.0.1-SNAPSHOT.jar apis.jar                                                                                                                                     0.1s
 => [3/5] RUN chmod 700 apis.jar                                                                                                                                                                          0.2s
 => [4/5] RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && echo Asia/Seoul > /etc/timezone                                                                                                              0.3s
 => [5/5] RUN apk add --no-cache tzdata                                                                                                                                                                             2.2s
 => exporting to image                                                                                                                                                                                              0.1s 
 => => exporting layers                                                                                                                                                                                             0.1s 
 => => writing image sha256:785742f0fe708e967de1d6798554ad57971b8c230e086a138bd433fd82fb7f14                                                                                                                        0.0s
 => => naming to docker.io/library/apis                                                                                                                                                                   0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
 % docker tag apis:latest 1234567890123.dkr.ecr.ap-northeast-2.amazonaws.com/apis:latest
 % docker push 1234567890123.dkr.ecr.ap-northeast-2.amazonaws.com/apis:latest                     
The push refers to repository [1234567890123.dkr.ecr.ap-northeast-2.amazonaws.com/apis]
a35650c997ae: Layer already exists 
636848a35a2e: Layer already exists 
cc9dde343c38: Layer already exists 
075f63b9484a: Layer already exists 
edd61588d126: Layer already exists 
9b9b7f3d56a0: Layer already exists 
f1b5933fe4b5: Layer already exists 
latest: digest: sha256:11535e47159948f3ab48390a4a2df384bcf4fb712b3f87483600f21e1e8057a9 size: 1788

 

 

 

빌드 할때 이렇게 플랫폼 옵션을 주면 문제없이 배포된다.

% docker build --platform linux/amd64 -t apis --build-arg profile=dev .

 

 

 

 

 

반응형
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함