dehio3’s diary

仕事、生活、趣味のメモ

Rundeckコンテナのbuild時に「no such group rundeck」エラー発生

事象

以下を元にRundeckを起動しようとしたところ、 buildでエラーが発生

github.com

# docker-compose build
WARNING: The RUNDECK_PLUGIN_EXECUTIONFILESTORAGE_S3_BUCKET variable is not set. Defaulting to a blank string.
WARNING: The RUNDECK_PLUGIN_EXECUTIONFILESTORAGE_S3_REGION variable is not set. Defaulting to a blank string.
WARNING: The RUNDECK_STORAGE_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The AWS_CREDENTIALS variable is not set. Defaulting to a blank string.
mysql uses an image, skipping
Building rundeck
Step 1/3 : ARG RUNDECK_IMAGE
Step 2/3 : FROM ${RUNDECK_IMAGE:-rundeck/rundeck:SNAPSHOT}
 ---> b41462fc4872
Step 3/3 : COPY --chown=rundeck:rundeck ./libext ./libext
ERROR: Service 'rundeck' failed to build: unable to convert uid/gid chown string to host mapping: can't find gid for group rundeck: no such group: rundeck

調査

dockerのバージョン

# docker -v
Docker version 18.06.1-ce, build e68fc7a215d7133c34aa18e3b72b4a21fd0c6136
# docker-compose -v
docker-compose version 1.22.0, build f46880fe

コンテナ内のユーザー情報を確認

取得してるイメージを確認

# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
rundeck/rundeck     SNAPSHOT            b41462fc4872        35 hours ago        510MB

イメージにログインしてユーザーを確認

# docker run -it --entrypoint "bash" rundeck/rundeck:SNAPSHOT
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

rundeck@7dc0282d5a53:~$ id
uid=1000(rundeck) gid=0(root) groups=0(root),27(sudo)

rundeckユーザーいるけど、グループがroot

rundeckグループはいる?

$ grep rundeck /etc/group
sudo:x:27:rundeck

rundeckグループがなかった。。

$ ls -l
total 144916
drwxr-xr-x 3 rundeck root        38 May 18 20:00 docker-lib
drwxrwxr-x 1 rundeck root       201 May 18 20:00 etc
drwxrwxr-x 2 rundeck root         6 May 18 20:00 libext
-rw-rw-r-- 1 rundeck root 148393216 May 18 20:00 rundeck.war
drwxrwxr-x 7 rundeck root        67 May 18 20:00 server
drwxrwxr-x 4 rundeck root        28 May 18 20:00 tools
drwxrwxr-x 2 rundeck root         6 May 18 20:00 user-assets
drwxrwxr-x 2 rundeck root        43 May 18 20:00 var

対応

グループをrootに変更

$ git diff
diff --git a/Dockerfile b/Dockerfile
index 8b4dd53..92f8ec7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,4 +2,4 @@ ARG RUNDECK_IMAGE
 
 FROM ${RUNDECK_IMAGE:-rundeck/rundeck:SNAPSHOT}
 
-COPY --chown=rundeck:rundeck ./libext ./libext
\ No newline at end of file
+COPY --chown=rundeck:root ./libext ./libext
\ No newline at end of file