如下下 Docker 官方文檔的說明: html
The docker daemon binds to a Unix socket instead of a TCP port. By default that 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 having to use sudo when you use 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 socket read/writable by the docker group.
sudo groupadd docker
sudo gpasswd -a ${USER} docker
下面是 CentOS7 的命令,其餘系統詳見 Docker 官方文檔:linux
# 下面是CentOS7的命令,其餘系統詳見 Docker 官方文檔 sudo systemctl restart docker
# 運行docker命令 docker ps 查看已運行的容器 docker ps # 運行docker命令 docker images 查看已下載的鏡像 docker images
參考文檔:docker
· Docker 官方文檔:https://docs.docker.com/engine/installation/bash
· Linux 命令大全:http://man.linuxde.net/socket
本文爲博主原創文章,轉載請註明出處!this