Skip to content

Instantly share code, notes, and snippets.

@jonleopard
Last active May 5, 2020 12:14
Show Gist options
  • Save jonleopard/65b8386f5aca7a74dc58787af3215405 to your computer and use it in GitHub Desktop.
Save jonleopard/65b8386f5aca7a74dc58787af3215405 to your computer and use it in GitHub Desktop.
migrate issue
version: '3.8'
services:
db:
image: postgres
environment:
POSTGRES_DB: mydbname
POSTGRES_USER: mydbuser
POSTGRES_PASSWORD: mydbpwd
ports:
- "5432:5432"
migrate:
image: migrate/migrate
volumes:
- ${PWD}:/migrations
depends_on:
- db
command: -source file:///migrations -database postgres://mydbuser:mydbpwd@db:5432/mydbname?sslmode=disable up
adminer:
image: adminer
restart: always
ports:
- "8081:8080"
environment:
ADMINER_DEFAULT_SERVER: db
depends_on:
- db

Method 1 (error: first : file does not exist)

docker run -v /Users/jon/projects/golang-learning/gowebexamples.com/goreddit/migrations:/migrations --network host migrate/migrate -source file:///migrations -database "postgresql://mydbuser:mydbpwd@localhost/mydbname?sslmode=disable" up

Method 2 (error: first : file does not exist)

docker run -v /Users/jon/projects/golang-learning/gowebexamples.com/goreddit/migrations:/migrations --network host migrate/migrate -path=/migrations/ -database "postgresql://mydbuser:mydbpwd@localhost/mydbname?sslmode=disable" up

docker-compose error output

docker-compose up migrate
goreddit_db_1 is up-to-date
Recreating goreddit_migrate_1 ... done
Attaching to goreddit_migrate_1
migrate_1  | error: first : file does not exist
goreddit_migrate_1 exited with code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment