Non-root users using Docker under Linux

Source: Internet
Author: User

Linux non-root users use Docker usually when we use the Linux system, it is best not to use the root account directly, but when using Docker, the default is not the use of non-root users, for reasons, the official statement is as follows:

The Docker daemon binds to a Unix socket instead of a TCP port. By default, Unix socket is owned by the user root and other users can access it with sudo. For this reason, Docker Daemon always runs as the root user.
To avoid has the use of sudo when your use of the Docker command, create a Unix group called Docker and add users to it. When the Docker daemon starts, it makes the ownership of the Unix sockets read/writable by the Docker group.

Here are the steps to make root available to non-root users: 1
创建docker组sudo groupadd docker
2
将当前用户加入docker组sudo gpasswd -a ${USER} docker
3
重新启动docker服务(下面是CentOS7的命令)sudo systemctl restart docker
4
当前用户退出系统重新登陆
5
运行docker命令,测试docker ps

Reference: http://blog.csdn.net/kongxx/article/details/52413332

Non-root users using Docker under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.