webエンジニアの気づき

都内ベンチャーでwebエンジニアとして働く著者が、web開発における気付きをまとめています。golang,railsやVue.js(Nuxt)を主に利用。

dockerでgoose up ができない問題

f:id:k-enter:20210404212717p:plain

コード

npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code ECONNREFUSED
npm ERR! syscall connect
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to https://registry.npmjs.org/@vue/cli/-/cli-4.5.12.tgz failed, reason: connect ECONNREFUSED 104.16.24.35:443
npm ERR!     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:97:14)
npm ERR!     at ClientRequest.emit (node:events:369:20)
npm ERR!     at TLSSocket.socketErrorListener (node:_http_client:462:9)
npm ERR!     at TLSSocket.emit (node:events:381:22)
npm ERR!     at emitErrorNT (node:internal/streams/destroy:188:8)
npm ERR!     at emitErrorCloseNT (node:internal/streams/destroy:153:3)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:81:21)
npm ERR!  FetchError: request to https://registry.npmjs.org/@vue/cli/-/cli-4.5.12.tgz failed, reason: connect ECONNREFUSED 104.16.24.35:443
npm ERR!     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:97:14)
npm ERR!     at ClientRequest.emit (node:events:369:20)
npm ERR!     at TLSSocket.socketErrorListener (node:_http_client:462:9)
npm ERR!     at TLSSocket.emit (node:events:381:22)
npm ERR!     at emitErrorNT (node:internal/streams/destroy:188:8)
npm ERR!     at emitErrorCloseNT (node:internal/streams/destroy:153:3)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:81:21) {
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect',
npm ERR!   address: '104.16.24.35',
npm ERR!   port: 443,
npm ERR!   type: 'system'
npm ERR! }
npm ERR! 
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-03-29T14_02_59_850Z-debug.log
ERROR: Service 'frontend' failed to build: The command '/bin/sh -c apk update &&     npm install -g npm &&     npm install -g @vue/cli' returned a non-zero code: 1

内容

dockerでdbというコンテナを立ち上げて、そこにbackendというコンテナからgooseでマイグレーションファイルを反映しようとした際に、dbコンテナhostがないと言われる。

原因と考えられること

・今まで利用できていたのに、リモートの本番環境を実装した後にローカルがエラーで動かなくなったので、docker-compose.local.yml(ローカル用のdockerのymllファイル)が原因ではないかと考えられる。

・dockerを再ビルドしても変化しなかったので、イメージが残っていることが原因かと考え、イメージを削除して再ビルドした。

やったこと

・dockerのイメージを削除→再ビルド&アップ

解決策

・dockerのイメージを削除→再ビルド&アップ

考え

残っていたDockerのイメージが何らかの影響を与えていたのかもしれない。もしくはコンテナ内でgoose upを使っていなかったかも。

参考

https://kumahiyo.com/goose-status/