Open anil-sezer opened 11 months ago
I got a weird problem. When I create my image with this workflow: ` name: Build and Push Docker Image
on: push: branches:
jobs: build: runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./Portfolio.WebUi
file: ./deployment/Dockerfile
platforms: linux/arm64
push: true
tags: anilsezer/portfolio:latest
`
I get Exec error when I try to deploy that. But, when I build and push locally from my raspberry pi, image runs. Why it might be?
The issue you're describing may stem from differences between the environment in which your Docker image is built by the GitHub Action and the environment on your Raspberry Pi. Let's identify some potential causes:
Platform Mismatch: Even though you specified platforms: linux/arm64
in the GitHub Actions workflow, there might still be nuances or differences compared to building it directly on the Raspberry Pi.
Base Image: Ensure that the base image you are using in your Dockerfile
is suitable for linux/arm64
. Sometimes, images can have platform-specific nuances. If possible, use an image that has a variant explicitly tailored for ARM architectures.
Build Context: Ensure that the build context (files, configurations, etc.) being used in the GitHub Actions workflow is the same as the one on your Raspberry Pi. There might be subtle differences that affect the build.
Dependencies: If your Dockerfile
installs any software or dependencies, it's possible that the versions or configurations fetched in the GitHub Actions runner environment differ from those fetched on your Raspberry Pi.
Detailed Error: "Exec error" is a general term. It would help to know more about the specific error you're encountering. This could provide clues about whether it's a problem with a particular binary, a missing library, or something else.
Dockerfile Commands: Some commands in the Dockerfile may have platform-specific behavior, especially if you are executing shell commands or installing packages.
Detailed Logs: When you encounter the "Exec error", gather as much detailed log information as you can. This will help narrow down the specific issue.
Run Locally: If you can, try to replicate the GitHub Actions environment on your Raspberry Pi. You can pull the built image from Docker Hub to your Raspberry Pi and run it there, then inspect any issues.
docker pull anilsezer/portfolio:latest
docker run --rm -it anilsezer/portfolio:latest /bin/sh (or /bin/bash)
This will give you an interactive shell inside the container, allowing you to probe around and potentially identify the issue.
Build Environment: Consider building the Docker image on another local machine with an ARM64 architecture (if available) using the same commands as the GitHub Actions, and see if you encounter the same problem.
Reproduce on x86: Though your target is ARM, you might try building and running the image on an x86 machine to see if the issue is architecture-specific.
QEMU: GitHub Actions uses QEMU for ARM emulation when building ARM-based images on x86 runners. While this usually works, there are occasional hiccups. Building directly on the Raspberry Pi avoids this layer of emulation, which might be why you see a difference.
In summary, there are many factors that could lead to differences between building the Docker image via GitHub Actions and directly on your Raspberry Pi. Narrowing down the exact error and conducting systematic tests will help pinpoint the root cause.
This happens when I build the image at my windows pc too. When I build arm64 or arm64v8 or arm64v7 image at my windows pc, it gives exec error at the Raspberry. But when I build amd64 image at the rpi it works. I should write to microsoft about this
Bunu çözemedim hala, stack overflow'a yazacam galiba
When I build the image via Github, it gives "exec error" when deployed. But when I build & push & deploy at Rpi, it works. Find why