testcontainers / testcontainers/testcontainers-java

[Bug]: Unable to run Elasticsearch with restrictive umask

オープン
#6,444 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

type/bug
主要言語
Java
スター
8.7k
フォーク
1.9k
平均マージ
2日 17時間
マージ済み PR(30日)
9

説明

Module

Elasticsearch

Testcontainers version

1.17.6

Using the latest Testcontainers version?

Yes

Host OS

Linux

Host Arch

x86_64

Docker version
Client: Docker Engine - Community
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:08 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:25:58 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
What happened?

I have a similar problem as discussed in ticket #4952 but for Elasticsearch. Elasticsearch fails to start with the following error:
Exception in thread "main" java.nio.file.AccessDeniedException: /usr/share/elasticsearch/config/jvm.options.d/ elasticsearch-default-memory-vm.options
Testcontainers library copies elasticsearch-default-memory-vm.options file into elasticsearch container with default file permissions which in my case is -rw------- because umask in my computer is set to 077. As uid and gid in my computer are different than those in elasticsearch container, this file is not accessible by elasticsearch and the mentioned error is thrown.

I guess the solution should be similar as in #5401 where temporary file is created with predefined permissions which allow reading the file for everyone instead of default permissions.

Relevant log output

No response

Additional Information

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、elasticsearch-default-memory-vm.options をコンテナにコピーする Elasticsearch モジュールのコードを追跡し、その一時ファイル処理を issues #4952 と #5401 で議論されている解決策と比較します。umask 077 で失敗を再現し、Elasticsearch が起動してコピーされたファイルを読み取れることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, elasticsearch, java
領域
devops, testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。