{"action":"created","issue":{"url":"https://api.github.com/repos/heroku/docker-ruby/issues/9","repository_url":"https://api.github.com/repos/heroku/docker-ruby","labels_url":"https://api.github.com/repos/heroku/docker-ruby/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/heroku/docker-ruby/issues/9/comments","events_url":"https://api.github.com/repos/heroku/docker-ruby/issues/9/events","html_url":"https://github.com/heroku/docker-ruby/issues/9","id":112643886,"number":9,"title":"Connection refused when running rake assets:precompile with database service","user":{"login":"paulodiovani","id":1295197,"avatar_url":"https://avatars.githubusercontent.com/u/1295197?v=3","gravatar_id":"","url":"https://api.github.com/users/paulodiovani","html_url":"https://github.com/paulodiovani","followers_url":"https://api.github.com/users/paulodiovani/followers","following_url":"https://api.github.com/users/paulodiovani/following{/other_user}","gists_url":"https://api.github.com/users/paulodiovani/gists{/gist_id}","starred_url":"https://api.github.com/users/paulodiovani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulodiovani/subscriptions","organizations_url":"https://api.github.com/users/paulodiovani/orgs","repos_url":"https://api.github.com/users/paulodiovani/repos","events_url":"https://api.github.com/users/paulodiovani/events{/privacy}","received_events_url":"https://api.github.com/users/paulodiovani/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-21T17:51:08Z","updated_at":"2016-04-01T21:58:32Z","closed_at":null,"body":"The step `rake assets:precompile` tries to connect to database and, as on build the links wasn't set yet, the build fails with:\r\n\r\n```console\r\nrake aborted!\r\nPG::ConnectionBad: could not connect to server: Connection refused\r\n        Is the server running on host \"localhost\" (::1) and accepting\r\n        TCP/IP connections on port 5432?\r\ncould not connect to server: Connection refused\r\n        Is the server running on host \"localhost\" (127.0.0.1) and accepting\r\n        TCP/IP connections on port 5432?\r\n```\r\n\r\nMy `docker-compose.yml` looks like:\r\n\r\n```yml\r\nweb:\r\n  build: .\r\n  command: 'bash -c ''bundle exec puma -C config/puma.rb'''\r\n  working_dir: /app/user\r\n  environment:\r\n    PORT: 8080\r\n    DATABASE_URL: 'postgres://postgres:@herokuPostgresql:5432/postgres'\r\n    REDIS_URL: 'redis://herokuRedis:6379'\r\n  ports:\r\n    - '8080:8080'\r\n  links:\r\n    - herokuPostgresql\r\n    - herokuRedis\r\nworker:\r\n  build: .\r\n  command: 'bash -c ''bundle exec sidekiq -C config/sidekiq.yml'''\r\n  working_dir: /app/user\r\n  environment:\r\n    DATABASE_URL: 'postgres://postgres:@herokuPostgresql:5432/postgres'\r\n    REDIS_URL: 'redis://herokuRedis:6379'\r\n  links:\r\n    - herokuPostgresql\r\n    - herokuRedis\r\nshell:\r\n  build: .\r\n  command: bash\r\n  working_dir: /app/user\r\n  environment:\r\n    PORT: 8080\r\n    DATABASE_URL: 'postgres://postgres:@herokuPostgresql:5432/postgres'\r\n    REDIS_URL: 'redis://herokuRedis:6379'\r\n  ports:\r\n    - '8080:8080'\r\n  links:\r\n    - herokuPostgresql\r\n    - herokuRedis\r\n  volumes:\r\n    - '.:/app/user'\r\nherokuPostgresql:\r\n  image: postgres\r\nherokuRedis:\r\n  image: redis\r\n```"},"comment":{"url":"https://api.github.com/repos/heroku/docker-ruby/issues/comments/204584105","html_url":"https://github.com/heroku/docker-ruby/issues/9#issuecomment-204584105","issue_url":"https://api.github.com/repos/heroku/docker-ruby/issues/9","id":204584105,"user":{"login":"paulodiovani","id":1295197,"avatar_url":"https://avatars.githubusercontent.com/u/1295197?v=3","gravatar_id":"","url":"https://api.github.com/users/paulodiovani","html_url":"https://github.com/paulodiovani","followers_url":"https://api.github.com/users/paulodiovani/followers","following_url":"https://api.github.com/users/paulodiovani/following{/other_user}","gists_url":"https://api.github.com/users/paulodiovani/gists{/gist_id}","starred_url":"https://api.github.com/users/paulodiovani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulodiovani/subscriptions","organizations_url":"https://api.github.com/users/paulodiovani/orgs","repos_url":"https://api.github.com/users/paulodiovani/repos","events_url":"https://api.github.com/users/paulodiovani/events{/privacy}","received_events_url":"https://api.github.com/users/paulodiovani/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T21:58:32Z","updated_at":"2016-04-01T21:58:32Z","body":"@hxegon if your problem happens whe running `docker build`, I think it's the same problem."}}