How to build docker-compose on AWS ES2 from image created on Mac M1? - amazon-ec2

I'm getting the error: exec /usr/local/bin/docker-entrypoint.sh: exec format error
or
The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested.
Added in docker-compose.yml
platform: linux/x86_64
and
platform: linux/arm64
and
platform: linux/arm64/v8
Added in Dockerfile
FROM --platform=linux/amd64 node:18-alpine
Tried to add in .env
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM=linux/amd64/v8
But it didn't help too.
Images are on Docker Hub.
How to make docker-compose work?

Related

Setting Up Chainlink Node with Linux Arm64 Chrome duet

I want to set up a chainlink node. I have a chrome duet linux Arm64. does this prevent me from setting up Chainlink node.
I installed Docker.
I set up the environment, ethereum feed, and database per docs.
Then I run this command:
cd ~/.chainlink-rinkeby && docker run -p 6688:6688 -v ~/.chainlink-rinkeby:/chainlink -it --env-file=.env smartcontract/chainlink:0.10.9 local n
I choose a version from Chainlink Hub link. But all I can see is AMD64.
This is the output I get:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error
Does anyone know what I can do next? thanks
All of the supported systems are listed on the docker page. If your system isn't supported, perhaps you can try installing go etc and trying to build from source?

how to run amd64 docker images on arm64 host platform

I have an m1 mac and I am trying to run a amd64 based docker image on my arm64 based host platform. However, when I try to do so (with docker run) I get the following error:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested.
When I try adding the tag --platform linux/amd64 the error message doesn't appear, but I can't seem to go into the relevant shell and docker ps -a shows that the container is immediately exited upon starting. Would anyone know how I can run this exact image on my machine given the circumstances/how to make the --platform tag work?
Using --platform is correct. On my M1 Mac I'm able to run both arm64 and amd64 versions of the Ubuntu image from Docker Hub. The machine hardware name provided by uname proves it.
# docker run --rm -ti --platform linux/arm/v7 ubuntu:latest uname -m
armv7l
# docker run --rm -ti --platform linux/amd64 ubuntu:latest uname -m
x86_64
Running amd64 images is enabled by Rosetta2 emulation, as indicated here.
Not all images are available for ARM64 architecture. You can add --platform linux/amd64 to run an Intel image under emulation.
If the container is exiting immediately, that's a problem with the specific container you're using.
To address the problem of your container immediately exiting after starting, try using the entrypoint flag to overwrite the container's entry point. It would look something like this:
docker run -it --entrypoint=/bin/bash image_name
Credit goes to this other SO answer that helped me solve a similar issue on my own container.

Is there OWASP ZAP docker image for windows platform?

The OWASP ZAP docker images are listed here: https://www.zaproxy.org/docs/docker/about/
When I run the following command to pull the stable docker image on my Windows OS: docker pull owasp/zap2docker-stable
I get the following error:
Using default tag: latest
latest: Pulling from owasp/zap2docker-stable
image operating system "linux" cannot be used on this platform
Is there OWASP ZAP docker image for windows platform?
The current ZAP docker images will work fine, you just need to enable switching between Windows and Linux containers: https://docs.docker.com/docker-for-windows/#switch-between-windows-and-linux-containers

Why is my docker build command failing

I have docker installed on my macbook pro OS Sierra 16G1212
I have a simple docker file in /mypath/Dockerfile
When I try the command:
docker build .
I get an error:
error checking context: 'can't stat '/Users/bdisha/Library/Caches/com.cisco.Jabber/com.apple.opencl''.
What am I doing wrong?
Thank you
The problem was resolved by me creating a "dockerfiles" directory and moving my Dockerfile in there.
After that, I could manage to build the image just fine.

.Net Core Web Api to Docker Container Mac

I have a mac and parallels with windows 10. I compiled the webapi template in visual studio 2017 on windows without docker support to a folder on my mac. For some reason, I can't get the docker image to run (hello-world image works fine). Docker is installed on the Mac. Here are my steps:
dotnet restore ./WebApplication1.sln
dotnet publish ./WebApplication1.sln -c Release -o ./obj/Docker/publish
Here is my docker file located in the project directory
FROM microsoft/aspnetcore:latest
ARG source
WORKDIR /app
EXPOSE 5000
COPY ${source:-obj/Docker/publish} /app
ENTRYPOINT ["dotnet", “WebApplication1.dll"]
Calling docker commands from the terminal
docker build WebApplication1 -t WebApplication1
docker run -d -p 5000:5000 WebApplication1
This gives me a container id but it never starts. I hope I am missing something simple. Please advise.
Using docker-compose solved the issue. There could have been some type of syntax error or typo in my previous post. It is worth it to use parallels, visual studio, and a mac. Running docker on anything less than Windows 10 enterprise is not supported with the latest version of docker.
version: '2'
services:
webapplication3:
image: webapplication3
build:
context: ./WebApplication3
dockerfile: Dockerfile
Docker File
FROM microsoft/aspnetcore:latest
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
RUN ls /app
ENTRYPOINT ["dotnet", "WebApplication3.dll"]

Resources