0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Docker】Unsupported config option for services.app: 'node'

Posted at

docker環境構築を作っていて、npmを初期化するコマンドを入力したら、Errorが発生した。

#docker-compose run --rm node npm init
ERROR: The Compose file './../docker-compose.yml' is invalid because:
Unsupported config option for services.app: 'node'

このError内容を見ると、docker-compose.ymlファイルの 'node' 辺りでErrorが発生しているみたい。。。

ymlファイルの該当箇所を確認したところ、本来は「services->node」が正しいが、「services->app->node」にインデントがずれていた。。。

間違い↓

version: '3'
services:
  app:
    image: nginx:latest
    container_name: "app"
    ports:
      - "8080:80"
    volumes:
      - ./src/html:/app
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    node:
      image: node:10
      container_name: node
      tty: true
      working_dir: /usr/src/app
      volumes:
       - ./src:/usr/src/app

正しい↓


version: '3'
services:
  app:
    image: nginx:latest
    container_name: "app"
    ports:
      - "8080:80"
    volumes:
      - ./src/html:/app
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
  node:
    image: node:10
    container_name: node
    tty: true
    working_dir: /usr/src/app
    volumes:
      - ./src:/usr/src/app

修正されたコードを実行したら

#docker-compose run --rm node npm init
Creating network "app_default" with the default driver
Pulling node (node:10)...
10: Pulling from library/node
0400ac8f7460: Pull complete
fa8559aa5ebb: Pull complete
da32bfbbc3ba: Pull complete
e1dc6725529d: Pull complete
572866ab72a6: Pull complete
63ee7d0b743d: Pull complete
90a199058c87: Pull complete
eec01b4217d9: Pull complete
a6a01f1bcd7b: Pull complete
Digest: sha256:9d06418fa4335f9cf96c59d5c09372f7a56329e7234456ee9fe2340c4ac35a95
Status: Downloaded newer image for node:10
Creating app_node_run ... done

無事成功!!!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?