Access to the mirror

#Find the mirror from the mirror repository
$ docker search [image name]
#Find mirrors with stars greater than 10 from the mirror repository
$ docker search --filter stars=10 [image name]
#Downloads or updates the specified image from the image repository
$ docker pull [image name][:tag]
#Downloads all the specified images from the mirror repository
$ docker pull -a [image name]
Copy the code

mirror

#Listing local Mirrors
$ docker images
#Delete (one or more) local mirrors
$ docker rmi [image name...]
#Forcibly delete (one or more) local mirrors
$ docker rmi -f [image name...]
#Update image
$ docker commit -m=[commit message] -a=[author] [container id] [image name]
#Build the image using Dockerfile
$ docker build -t [image name] [dockerfile path]
#Saves the specified image file as a tar archive
$ docker save -o [path] [image name]
#Import the archive (exported using the docker save command)
$ docker load -i [path]
#Importing archive Files
$ docker import [path] [image name]
Copy the code

Container operation

#Lists running containers
$ docker ps
#List all containers
$ docker ps -a
#Save the file system as a tar archive
$ docker export -o [path] [container name]
#View port mappings for the specified container
$ docker port [container name]
Copy the code

Lifecycle management of containers

#Create containers using images and run them in the background
$ docker run -d --name [container name] [image name]
#Create the container and map the container port to the host port
$ docker run -d --name [container name] -p [local port]:[container port] [image name]
#Start (one or more) stopped containers
$ docker start [container name...]
#Close (one or more) running containers
$ docker stop [container name...]
#Restart (one or more) containers
$ docker restart [container name...]
#Kill a running container
$ docker kill [container name]
#Delete (one or more) containers
$ docker rm [container name...]
#Create a container without starting it
$ docker create --name [container name] [image name]
#Execute the container in bash
$ docker exec -it [container name] /bin/bash
Copy the code

docker –help

Commands: attach Attach local standard input, output, And error streams to a running container streams local standard input, output, and error streams to a running container Commit Create a new image from a container's changes Cp Copy files/folders between a container And the local filesystem copies files/folders between a Container and the local filesystem create create a new container Diff Inspect Changes to files or directories on a container's filesystem Exec Run a command in a running Container Run the export export a container's command in a running container Filesystem as a tar archive export the filesystem of a container as a tar archive. History Show the history of an image Images import import the contents from a tarball to create a filesystem image Import the contents from a tarball to create a filesystem image Inspect Return low-level information on Docker objects inspect Return low-level information on Docker objects kill kill one Containers load an image from a tar archive or STDIN to load an image from a compressed archive or STDIN Login Log in to a Docker registry logout Log out from a Docker registry Fetch the logs of a Container Captures logs from a Container pause Pause all processes within one or more Containers Suspends all processes in one or more Containers port List port Mappings or a specific mapping for the container List the port mappings or specific mappings of the container. Ps List Containers List all containers Repository from a registry Push an image or a repository to a registry rename push an image or a repository to a registry rename Rename a container Rename a container restart restart one or more containers Restart one or more containers rm Remove one or more containers Remove one or more containers Rmi Remove one or more images Run run a command in a new container Run the save save one or more images command in a new container To a tar archive (streamed to STDOUT by default) Save one or more images to a compressed archive (streamed to STDOUT by default) Search Search the Docker Hub for images on streaming index Stats Display a live stream of containers stats Display a live stream of containers (s) Resource Usage Statistics Real-time stream of resource usage statistics on containers Stop Stop one or more running containers Stop one or more containers in operation tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE Create a tag that refers to SOURCE_IMAGE TARGET_IMAG top Display the running processes of a Container Displays all running processes in a container unpause unpause all processes within one or more containers Unsuspend all processes in one or more containers update Update Configuration of one or more containers Updates the configuration of one or more containers version Show the Docker version information Wait Block displays the version information of containers until one or more containers stop, Then print their exit codes block until one or more containers stop, and then print their exit codes Run 'docker COMMAND --help' for more information on a COMMAND.Copy the code