Home>Article>Operation and Maintenance> How to restart docker as a normal user?

How to restart docker as a normal user?

coldplay.xixi
coldplay.xixi Original
2020-06-19 09:48:30 2951browse

How to restart docker as a normal user?

How to restart docker as a normal user?

How to restart docker for ordinary users:

1. Docker ordinary user manual

1. Ordinary users Using the docker service

-a represents append, which means adding the user to a new user group without leaving other user groups. To use -G with

usermod -a -G docker username

add the user to the group and then restart docker

sudo systemctl restart docker

2. If you want to change the main user group of username to docker at the same time, use the -g option directly:

usermod -g docker username

3. If you delete a user from a certain group;

gpasswd -d username group

2. Ordinary users create docker containers and use the poweroff command in the container to close the container

1) Main parameters

--privileged

/usr/sbin/init

eg:

[dataexa@localhost run]$

docker run --privileged -itd --name centos_7 centos /usr/sbin/init
4c5d90bf919fe530b7251d6e5cce7ef24efa66b7db3c3d2f7a96447837ff586f

3. Modify user ID group ID

[root@packrat ~]# id aipf uid=1000(aipf) gid=1000(aipf) 组=1000(aipf) 修改用户uid [root@packrat ~]# usermod -u 1271 aipf 修改用户的gid [root@packrat ~]# usermod -g 1271 aipf 修改用户组id [root@packrat ~]# groupmod -g 1271 aipf

Recommended tutorial: "docker tutorial"

The above is the detailed content of How to restart docker as a normal user?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn