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語言寫的)