LoginSignup
0
0

SudoなしでDockerコマンドを実行する

Last updated at Posted at 2023-06-04

通常だとroot権限で実行する必要がある。 sudo付けずに実行しようとするとエラーになる。
Dockerの権限もしくは権限グループを変更する必要があるが、公式では後者が推奨されている。

Receiving errors when trying to run without root?
The docker user group exists but contains no users, which is why you’re required to use sudo to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.

方法

現在のユーザーをDockerグループに所属させる

sudo usermod -aG docker ${USER}

変更を反映

su - ${USER}

確認

現在のユーザーが所属するグループの中に「docker」がればOK

id -nG
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