124 文字
1 分
How to run docker commands without sudo (2025)
TIP

A quick memo on how to use the docker command without sudo — I keep forgetting the exact steps, so writing it down.

Overview#

Docker is handy for machine learning development. After installing it though, commands like docker ps often fail with a permission error. Since I keep forgetting the steps to run docker without sudo, I’m leaving them here as a personal note.

Prerequisites#

  • Docker is already installed

Steps#

# Create the docker group if it doesn't exist
sudo groupadd docker
# Add the current user to the docker group
sudo gpasswd -a $USER docker
# Restart the docker daemon (CentOS 7 case)
sudo systemctl restart docker
# Log out and log back in to apply the changes
exit

Wrap up#

Make docker easier to use and enjoy your dev life!

How to run docker commands without sudo (2025)
https://yurudeep.com/posts/devenv/2025/20251227/en/
作者
ひらノルム
公開日
2025-12-27
ライセンス
CC BY-NC-SA 4.0