Container creation and basic commands for Docker

Source: Internet
Author: User
Tags nameserver docker ps docker hub docker run

1. Using Docker run to create a Docker container (Docker commands are all started with Docker) after the Docker is installed, most of the time this machine does not typically have a docker image on it, and when performing a docker run, it is common to view the local mirror. If it is not locally, it will automatically download the image from the Docker hub. Docker's domain name resolution server is Google, so you need to add 8.8.8.8 and 8.8.4.4 DNS server IP to the domain Name System. The operation under Ubuntu is to open/etc/resolv.conf, add two lines nameserver 8.8.8.8 and nameserver 8.8.4.4.  2. Next use the command Docker run-i-T Mirror name/bin/bash to create a container, such as     docker-i-T Ubuntu/bin/bash, where using the-t parameter is specifying an interaction is the command line,  &nbs P To execute this command, if there is a local mirror, create a container with a local image, and if not, the download time may be a bit long if the image is not downloaded from the Docker hub.     When the command finishes executing, it creates a container to launch and enter into the shell inside the container. Inside this container is exactly the same as the normal Linux operation.  3. Container common management commands     Docker run creates and launches a container, with the-D parameter followed by run, a daemon container is created to run in the background.     Docker ps-a View containers that have been created     Docker ps-s View started containers     Docker start Con_name boot container named Con_name Containers     Docker stop con_name stop containers named Con_name     Docker RM con_name Delete containers named Con_name     doc Ker Rename old_name new_name rename a container     Docker attach con_name attach the terminal to the terminal of a container named Con_name in the running container, If the container is created and the corresponding SH is executed, pressing ENTER willInto the container's command-line shell.     Docker logs con_name get container name con_name container log     Docker inspect view container details     Docker top Con_n Ame View containers named Con_name inside of a process     Docker exec can be used to run a process summary in a container: Docker's management commands are all starting with Docker, with an easy-to-understand word, unfamiliar with the parameters of a command , you can use Docker command--help to view relevant parameter meanings

Container creation for Docker and basic 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.