LoginSignup
1
3

More than 1 year has passed since last update.

docker-composeでcifs(smb)をマウントする

Last updated at Posted at 2022-12-18

docker-composeでcifs(smb)をマウントする

docker自体にcifsをマウントする仕組みがあるため、コンテナには別途パッケージを追加することなく使えます

version: '3'
services:
  hoge-service:
    image: ubuntu:latest
    volumes:
      - my-smb:/smb

volumes:
  my-smb:
    driver_opts:
      type: cifs
      o: "username=user,password=password"
      device: "//192.168.1.1/hoge"

ポイント

  • 接続対象には生のipアドレスを指定する必要がある
    • ホスト名では名前解決出来ずに繋がらない

参考

https://matsuand.github.io/docs.docker.jp.onthefly/storage/volumes/
https://stackoverflow.com/questions/66921235/smb-cifs-volume-in-docker-compose-on-windows
https://blog.cles.jp/item/12831

1
3
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
1
3