Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danstoner opened this issue Aug 9, 2024 · 9 comments
Open

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

danstoner opened this issue Aug 9, 2024 · 9 comments

Comments

@danstoner
Copy link

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.

@thomasstxyz
Copy link

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

@hanefi
Copy link
Contributor

hanefi commented Aug 15, 2024

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

@dimitri
Copy link
Owner

dimitri commented Sep 2, 2024

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

@thomasstxyz
Copy link

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

@dimitri
Copy link
Owner

dimitri commented Sep 2, 2024

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?

@thomasstxyz
Copy link

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.

@mldisibio
Copy link

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.

@danstoner
Copy link
Author

@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?

@thomasstxyz
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants