50
30

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 5 years have passed since last update.

docker-compose.ymlでworking directoryを指定する

Posted at

Dockerfileの WORKDIR は知っていたがdocker-compose.ymlの場合の書き方が分からず手が止まった。
当てずっぽうで同じように workdir: と書いて動かしたら、

Unsupported config option for services.dev-env: 'workdir' (did you mean 'working_dir'?)

と親切なメッセージ。
というわけで次のようにすればよい。

docker-compose.yml
version: '3'
service:
  app:
    image: alpine:latest
    volumes:
      - ./:/worker
    working_dir: /worker
50
30
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
50
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?