ankane/pgsync

Problem/suggestions regarding using the Docker image?

Closed this issue · 2 comments

I'm looking to use the Docker image as opposed to installing the gem manually - however, I cannot get the Docker image to reference the .pgsync file in my app.

I'm doing the following:

  1. Navigate to the root of my app (root contains a .pgsync file, with the to and from values hardcoded to avoid any env variable mishaps.
  2. Run docker pull ankane/pgsync to fetch the image.
  3. Run docker run -it ankane/pgsync

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
No source

If I run

docker run -it ankane/pgsync --debug

I get the same error.

/usr/local/bundle/gems/pgsync-0.7.4/lib/pgsync/sync.rb:30:in `perform': No source (PgSync::Error)
	from /usr/local/bundle/gems/pgsync-0.7.4/lib/pgsync/client.rb:26:in `perform'
	from /usr/local/bundle/gems/pgsync-0.7.4/lib/pgsync/client.rb:35:in `start'
	from /usr/local/bundle/gems/pgsync-0.7.4/exe/pgsync:7:in `<top (required)>'
	from /usr/local/bundle/bin/pgsync:25:in `load'
	from /usr/local/bundle/bin/pgsync:25:in `<main>'

Am I missing something on how the docker image should be used in this context? (I'm really aiming to use the image in concert with a dockerized app, but am now running it against a normal Rails setup to validate.)

ankane commented

Hi @chrismanderson, you'll need to mount or copy the file to the image (otherwise, Docker can't access it).

docker run -ti -v "$(pwd)":/app ankane/pgsync --config /app/.pgsync.yml

Thank you - my db values in the .pgsync are generated from Heroku CLI - so I was hoping to reference the file 'locally' first and expose that to the container, but in hindsight that doesn't make much sense. Will likely keep poking around at passing an env variable up instead - thank you!