1、下载镜像
? ~ docker pull ubuntu:16.04 16.04: Pulling from library/ubuntu Digest: sha256:ec0e4e8bf2c1178e025099eed57c566959bb408c6b478c284c1683bc4298b683 Status: Downloaded newer image for ubuntu:16.04
2、以这个镜像为基础启动一个容器来运行
? ~ docker run -it --rm ubuntu:16.04 bash root@5ddef21c5dee:/# cat /etc/os-release NAME="Ubuntu" VERSION="16.04.3 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04.3 LTS" VERSION_ID="16.04" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial root@5ddef21c5dee:/# exit exit ? ~
3、退出容器
? ~ docker run -it --rm ubuntu:16.04 bash root@ce2b5c847ba2:/# exit exit ? ~
4、列出已经下载下来的镜像,可以使用 docker image ls
命令
? ~ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu 16.04 00fd29ccc6f1 2 days ago 111MB ubuntu latest 00fd29ccc6f1 2 days ago 111MB node latest 3d1823068e39 3 days ago 676MB python latest a8f7167de312 4 days ago 691MB nginx latest f895b3fb9e30 5 days ago 108MB thrift latest f7f29323cc87 5 days ago 143MB mongo latest 26d5e4f5070d 5 days ago 367MB brennovich/protobuf-tools latest 459809ba3a10 3 weeks ago 882MB hello-world latest f2a91732366c 3 weeks ago 1.85kB ? ~
5、查找监听端口 25 的进程
lsof -i :80
关闭所有监听80端口的进程
? ~ kill -9 $(lsof -i:80 -t)