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