Common docker commands

Source: Internet
Author: User

# Systemctl start docker // start docker

# Systemctl restart docker // restart docker

# Systemctl enable docker // set to enable auto-start

# Docker version // view the docker version

# Docker info // view docker details

# Docker -- help // view the help manual (detailed usage of docker commands)

# Docker images-A // view the existing docker Image

# Docker RMI (image ID) // Delete the running image file (-F: Force delete)

# Docker search XXXX-S 30 // search for images over 30 liked on docker Hub

# Docker pull XXXX // download the latest image information by default

# Docker run-It XXXX // run the docker Image

-I: Run containers interactively.

-T: re-allocate a pseudo-input terminal for the container

-D: start the process later (but the container must have a front-end process with the response, or the background process will automatically kill it if it thinks there is nothing to do; add a front-end interactive script: docker run-D centos/bin/sh-C ''while true; do echo Hello mycentos; sleep 5; done" -- name mycentos)

-- Name: Name the running container

-P: random port ing

-P: Specifies port ing (1.ip: hostport: containerport. 2.ip:: containerport. 3. hostport: containerport 4. containerport)

# Docker PS-A // view all docker Processes

# Docker PS-N 5 // view the last five docker Processes

# Docker stop (container ID) // stop the running container

# Docker start (container ID) // start the container

# Ctrl + q + P // temporarily exit the container

# Docker RM (container ID) // Delete the running container

# Docker logs-T (container ID) // view the logs of the running container

-T: Timestamp added

-F: prints the latest logs.

-- Tail 5: print the last five lines of logs

# Docker inspect (container ID) // view the internal details of the container

# Docker Exec-It (container ID) ls-L/home // run the container outside docker (view the information in the home directory of the centos container)

# Docker attach (container ID) // re-join the interactive interface

# Docker CP (container ID):/home/a. log/root // copy the. log file in the container to the external root directory.

Common docker commands

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.