Docker Common Commands

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Docker check

View version

$docker --version #查看版本$docker-compose --version #查看版本$docker-machine --version #查看版本$docker version #查看client和server端版本,并可以查看是否开启体验功能

Check

$docker ps # 查看当前正在运行的image实例$docker ps -a #查看所有镜像实例$docker run hello-world #验证docker是否在运行中

Mirroring operations

$docker build -t <image-name> . #使用当前目录下的Dockerfile构建镜像$docker images #查看镜像$docker image ls -a  显示机器上所有的镜像$docker image rm <image id>      删除指定的镜像$docker image rm $(docker image ls -a -q)  删除所有的镜像$docker rmi [image-id/image-name] #删除指定的镜像,如docker rmi nginx$docker tag <image> <username>/<repository>:<tag> #为自定义的镜像打上tag。如:$docker tag hellopython followtry/demo:latest$docker push <username>/<repository>:<tag> #将自定义的镜像发布到仓库。如:docker push followtry/demo:latest    上传后访问地址:https://cloud.docker.com/swarm/followtry/repository/docker/followtry/demo/general$docker pull <username>/<repository> #pull自定义的上传上去的镜像。如:$docker pull followtry/demo$docker run username/repository:tag #运行仓库的镜像

Container operations

$docker container ls #列出所有运行中的容器$docker container ls -a #列出所有容器,包括未运行的$docker container stop 

Docker operations

$/Applications/Docker.app/Contents/MacOS/Docker --uninstall #docker卸载

Users and Groups

$docker login #登录

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.