0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Rootless Docker導入

Last updated at Posted at 2025-01-10

インストール

sudo apt-get -y install uidmap
curl -fsSL https://get.docker.com/rootless | sh
# 表示に従い下記2行を.bashrcに
export PATH=$HOME/bin:$PATH
export DOCKER_HOST=unix:///run/user/`id -u`//docker.sock

~/bin 以下にインストールされる

(必要なら)Proxy設定追加

~/.config/systemd/user/docker.service
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:8080"
Environment="HTTPS_PROXY=http://proxy.example.com:8080"
Environment="NO_PROXY=localhost,127.0.0.1,.internal.example.com"
設定後再起動
systemctl --user daemon-reload
systemctl --user restart docker.service
systemctl --user status docker # 起動確認

実行確認

docker run --rm -it -v $PWD:/root ubuntu touch /root/xxx 
ls -al xxx
# 生成された./xxxのownerが自分であることを確認

rootfulモードとの切り替え

docker context use default #デフォルト(Rootful)に切り替え

sudo docker run --rm -it -v $PWD:/root ubuntu touch /root/xxx 
# 生成された./xxxのownerがrootであることを確認
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?