Help us understand the problem. What is going on with this article?

docker-compose volumeマウント

More than 1 year has passed since last update.

概要

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
hanasaku
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした