Skip to content

Commit

Permalink
Update 02-install-docker.md
Browse files Browse the repository at this point in the history
  • Loading branch information
phyuany authored Aug 19, 2024
1 parent 86069a6 commit 78fa236
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/04.extend/02-install-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@ systemctl start docker.service
systemctl enable docker.service
```

### 3.4 非root用户使用docker

如果您想以非 root 用户身份运行 docker,那么您需要将其添加到 docker 组。

如果 docker 用户组不存在,先创建 docker 用户组,如下命令

```shell
sudo groupadd docker
```

将用户添加到 docker 组,如下命令

```shell
sudo usermod -aG docker $USER
```

登录到新的 docker 组(以避免再次登出/登录; 但如果不行,可以重新启动系统)

```shell
newgrp docker
```

## 四、验证docker

运行一个nginx容器,如下命令
Expand Down

0 comments on commit 78fa236

Please sign in to comment.