7
4

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 volumeマウント

Last updated at Posted at 2019-05-20

#概要
docker-composeでマウントをするが、コンテナ側から出力するファイルがホスト側のフォルダに書き込まれないエラーになりハマったので備忘録として残しておく。

#パーミッションになるエラー
コンテナ内で作成したファイルの書き込みができない。

version: '3'
services:
  app:
    build: ./docker/php
    volumes:
      - ./www:/var/www/html

#対処
yamlのトップレベルにvolumes:を置いてボリュームを定義する。

services:
  app:
    build: ./docker/php
    volumes:
      - www:/var/www/html

volumes:
  www:
    driver_opts:
      type: none
      # 絶対パスで指定する
      device: /home/user/www
      o: bind
7
4
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
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?