for ubuntu trusty, wily, and xenial, it’s recommended to install the linux-image-extra kernel package. the linux-image-extra package allows you use the aufs storage driver可以实现容器间可执行文件和运行库的共享。
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.
创建用户组docker,可以避免使用sudo
将docker和wxl(王小雷用户名,在创建主机时默认用户名称是ubuntu)添加到一个组内
注意需要重新启动计算机或者注销用户再登入,才能生效。这样就不需要使用sudo命令了。
那么,如何将wxl从docker用户组移除?
sudo gpasswd -d wxl docker
如何删除刚才创建的docker用户组?
sudo groupdel docker
如何创建和删除新用户,如用户newuser
sudo adduser newuser
sudo userdel newuser
docker run ubuntu /bin/echo “hello world” -运行ubuntu镜像并且在命令窗口输出”hello world”
docker run -t -i ubuntu /bin/bash -进入ubuntu这个镜像的bash命令窗口,可以操作本镜像ubuntu的命令如ls
docker ps - 列出当前运行的容器
docker logs - 展示容器的标准的输出(比如hello world)
docker stop - 停止正在运行的容器
docker version -可以查看守护的进程,docker版本以及go版本(docker本身是用go语言写的)