pgcopydb icon indicating copy to clipboard operation
pgcopydb copied to clipboard

problem with docker image `dimitri/pgcopydb:v0.17` ?

Open danstoner opened this issue 1 year ago • 9 comments

I get "exec format error" when trying to run the latest docker image.

$ docker run --network=host --rm -it dimitri/pgcopydb:v0.17 pgcopydb --help
standard_init_linux.go:180: exec user process caused "exec format error"

This works fine with previous versions (v0.16, v0.15, ...).

$ docker run --network=host --rm -it dimitri/pgcopydb:v0.15 pgcopydb --help
17:19:32.985 1 INFO   Running pgcopydb version 0.15 from "/usr/local/bin/pgcopydb"
pgcopydb: pgcopydb tool
usage: pgcopydb [ --verbose --quiet ]


Available commands:
  pgcopydb
    clone     Clone an entire database from source to target
    fork      Clone an entire database from source to target
...

Docker is supposed to handle all that platform stuff automatically. By using docker inspect I see that the image getting pulled was built for 'arm64' even though I am running this command on Intel hardware. My docker is apparently so old I don't have the pull --platform option or manifest options.

So, moved on to an Intel MacBook with newer docker installed, I can see the following:

$ docker pull --platform linux/amd64  dimitri/pgcopydb:v0.17
$ docker run --network=host --rm -it dimitri/pgcopydb:v0.17 pgcopydb --help
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested

So I think something is wrong in the docker repo where it is always serving the arm64 image.

danstoner avatar Aug 09 '24 17:08 danstoner

I'm currently facing the same problem. I'm using the image as a runtime container for a GitHub Workflow.

Do you know the issue? @dimitri

thomasstxyz avatar Aug 13 '24 19:08 thomasstxyz

There is only one docker image for v1.7 with OS/ARCH pair of linux/arm64/v8.

In earlier releases, we had only linux/amd64, and it changed in the last release for some reason.

See the relevant docker hub page

hanefi avatar Aug 15 '24 10:08 hanefi

Is there anything we should be doing about that issue then?

dimitri avatar Sep 02 '24 09:09 dimitri

Yes, in my opinion, the container registry at dimitri/pgcopydb should host images for both platforms (linux/amd64, linux/arm64/v8).

thomasstxyz avatar Sep 02 '24 10:09 thomasstxyz

We do not have automated builds on dockerhub, and my attempts to build for linux/amd64 from my current laptop are failing, all I seem to be able to get is an image for linux/arm64. Help?

dimitri avatar Sep 02 '24 12:09 dimitri

Oh I see. So the issue would be resolved if we add automated image build and push to Docker Hub here https://github.com/dimitri/pgcopydb/blob/main/.github/workflows/docker-publish.yml ? As far as I see it's only configured to push to GitHub Container Registry, at the moment.

thomasstxyz avatar Sep 02 '24 12:09 thomasstxyz

As a workaround I was able to get an amd64 image using docker pull --platform linux/amd64 ghcr.io/dimitri/pgcopydb:latest but I also usually pull from docker hub, so had to also change my docker scripts for the image name and tag.

mldisibio avatar Sep 04 '24 04:09 mldisibio

@dimitri

From a Medium article:

The Docker documentation describes how this can be accomplished https://docs.docker.com/engine/reference/builder/#from using the --platform argument with the FROM command.

This will tell Docker to specifically build for linux/amd64 when it is generating the image and now your image that is being built on MacOS will be compatible and deployable to ECS/EKS.

So, for example, in Dockerfile.debian I think changing the first line:

FROM debian:sid

to:

FROM --platform=linux/amd64 debian:sid

might build the non-ARM version.

You mentioned:

my attempts to build for linux/amd64 from my current laptop are failing

Can you elaborate?

danstoner avatar Sep 12 '24 20:09 danstoner

I'm pretty sure what is missing here is just the GitHub Workflow, which pushes the image to both GHCR and DockerHub.

If you can not find anyone, I could also contribute this feature.

thomasstxyz avatar Sep 13 '24 09:09 thomasstxyz

https://docs.docker.com/build/ci/github-actions/multi-platform/ Looks like the platform is missing, I'll try to add it later

exfly avatar Apr 09 '25 09:04 exfly