レンタルサーバーにRootless Dockerが入らなかった話

DockerにはRootlessモードというroot以外でDockerデーモンを起動するモードが用意されているので、もしかするとレンタルサーバーのようなroot付与されていないユーザーでも実行できるのではと試したのですが失敗した話です。

↑がこの記事の要約

Docker の Rootlessモードとはこちら

https://docs.docker.com/engine/security/rootless/

私がいつも使っているレンタルサーバーはXSERVER(エックスサーバー)なのですが、ディストリビューションはCentOS7、事前準備としては以下が必要です。

Add user.max_user_namespaces=28633 to /etc/sysctl.conf (or /etc/sysctl.d) and run sudo sysctl --system.

systemctl --user does not work by default. Run dockerd-rootless.sh directly without systemd.

https://docs.docker.com/engine/security/rootless/

user.max_user_namespaces=28633 を追加しろと言われていますがsudo権限はないので追加できません。

現状の設定を確認してみると0になっています。

$ sysctl --all 2>&1 | grep user.max_user_namespaces
user.max_user_namespaces = 0

インストール出来ないのは分かっていますが、インストール用のコマンドを実行

$ curl -fsSL https://get.docker.com/rootless | sh
# Installing stable version 20.10.17
# Executing docker rootless install script, commit: b2e29ef
# Missing system requirements. Please run following commands to
# install the requirements and run this installer again.
# Alternatively iptables checks can be disabled with SKIP_IPTABLES=1

cat <<EOF | sudo sh -x

cat <<EOT > /etc/sysctl.d/51-rootless.conf
user.max_user_namespaces = 28633
EOT
sysctl --system
EOF

案の定sudoを実行して追加が必要とのことで諦めました。終了です。。

ちなみに

こちらの記事で追加したHomeBrewからdockerコマンドは追加できました。

https://rensaba-programer.jp/2022/08/07/レンタルサーバーにhomebrewを入れる/
$ brew install docker
Warning: Treating docker as a formula. For the cask, use homebrew/cask/docker
Warning: docker 20.10.17 is already installed and up-to-date.
To reinstall 20.10.17, run:
  brew reinstall docker
$ which docker
~/.linuxbrew/bin/docker

dockerデーモンは起動できませんが、レンタルサーバーから別環境で実行されているdockerの操作は出来そうです(需要あるのかは疑問ですが)

投稿者


Comments

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA