This is the 18th day of my participation in the More text Challenge. For more details, see more text Challenge

See what docker has with the command:

docker -h
Copy the code

You get the following results:

A self-sufficient runtime for linux containers. Options: \--api-cors-header= Set CORS headers in the remote API \-b, --bridge= Attach containers to a network bridge \--bip= Specify network bridge IP \-D, --debug=false Enable debug mode \-d, --daemon=false Enable daemon mode \--default-gateway= Container default gateway IPv4 address \--default-gateway-v6= Container default gateway IPv6 address \--default-ulimit=\[\] Set default ulimits for containers \--dns=\[\] DNS server to use \--dns-search=\[\] DNS search domains to use \-e, --exec-driver=native Exec driver to use \--exec-opt=\[\] Set exec driver options \--exec-root=/var/run/docker Root of the Docker execdriver \--fixed-cidr= IPv4 subnet for fixed IPs \--fixed-cidr-v6= IPv6 subnet for fixed IPs \-G, --group=docker Group for the unix socket \-g, --graph=/var/lib/docker Root of the Docker runtime \-H, --host=\[\] Daemon socket(s) to connect to \-h, --help=false Print usage \--icc=true Enable inter-container communication \--insecure-registry=\[\] Enable insecure Registry communication \-- IP =0.0.0.0 Default IP when binding container ports \--ip-forward=true Enable net.ipv4.ip\_forward \--ip-masq=true Enable IP masquerading \--iptables=true Enable addition of iptables rules \--ipv6=false Enable IPv6 networking \-l, --log-level=info Set the logging level \--label=\[\] Set key=value labels to the daemon \--log-driver=json-file Default driver for container logs \--log-opt=map\[\] Set log driver options \--mtu=0 Set the containers network MTU \-p, --pidfile=/var/run/docker.pid Path to use for daemon PID file --registry-mirror=\[\] Preferred Docker registry mirror \-s, --storage-driver= Storage driver to use \--selinux-enabled=false Enable selinux support \--storage-opt=\[\] Set storage driver options \--tls=false Use TLS; implied by --tlsverify \--tlscacert=~/.docker/ca.pem Trust certs signed only by this CA \--tlscert=~/.docker/cert.pem Path to TLS certificate file --tlskey=~/.docker/key.pem Path to TLS key file --tlsverify=false Use TLS and verify the remote \--userland-proxy=true Use userland proxy for loopback traffic \-v, --version=false Print version information and quit Commands: attach Attach to a running container build Build an image from a Dockerfile commit Create a new image from a container's  changes cp Copy files/folders from a container's filesystem to the host path create Create a new container diff Inspect  changes on a container's filesystem events Get real time events from the server exec Run a command in a running container export Stream the contents of a container as a tar archive history Show the history of an image images List images import Create a new filesystem image from the contents of a tarball info Display system-wide information inspect Return low\-level information on a container or image kill Kill a running container load Load an image from a tar archive login Register or log in to a Docker registry server logout Log out from a Docker registry server logs Fetch the  logs of a container pause Pause all processes within a container port Lookup the public\-facing port that is NAT-ed to PRIVATE\_PORT ps List containers pull Pull an image or a repository from a Docker registry server push Push an image or a repository to a Docker registry server rename Rename an existing container restart Restart a running container rm Remove one or more containers rmi Remove one or more images run Run a command in a new container save Save an image to a  tar archive search Search for an image on the Docker Hub start Start a stopped container stats Display a stream of a containers' resource usage statistics stop Stop a running container tag Tag an image into a repository top Lookup the running processes of a container unpause Unpause a paused container version Show the Docker version information wait Block until a container stops, then print its exit code Run 'docker COMMAND --help' for more information on a command.Copy the code

Let’s elaborate on some of these commands. Before I do, let’s say that if you don’t understand Docker and Docker Hub and their relationship, you can use Git and GitHub to understand them.

1. docker version

Example Display Docker version information.

2. docker info

Display Docker system information, including image and container number.

3. docker search

Search Docker Hub for images that match the criteria.

docker search -s 3 --automated --no-trunc django
Copy the code

The above command means to search for any Django images that have at least 3 favorites and can be automatically built, and display the full description of the image.

Parameters:

--automated=false Only show automated Builds lists Only images of automated build type \-- no-Trunc =false Don't truncate Output Displays full image description -s, --stars=0 Only displays with at least x starsCopy the code

4. docker pull

Pulls or updates the specified image from Docker Hub.

docker pull ubuntu:latest
Copy the code

The above command means to pull ubuntu’s latest image.

Parameters:

\-a, --all-tags=false Download all tagged images in the repositoryCopy the code

5. docker login

Follow the steps to enter your registered user name, password and email address on Docker Hub to complete the login.

6. docker logout

Log out from the specified server, which is the official server by default.

Docker images lists all local images. Query the image name by keyword.

docker images ubuntu
Copy the code

The above command means to list all images with the local image name Ubuntu. Without Ubuntu, all local images are listed.

Parameters:

-a, --all=false Show all images (default hides intermediate images) --filter= false Show digests -f, --filter=\[\] filter output based on conditions provided -f \['dangling=true'\] Select one of the images in which the request was made --no-trunc=false Don't display the full image ID -q, --quiet=false Only show numeric IDs Lists Only image IDsCopy the code

8. docker ps

List all running containers.

Parameters:

-a, --before= Show only container created before --all=false Show all containers (default shows just running Id or Name lists containers that were created before a container, Accept the container name and ID as parameters \-f, --filter=\[\] filter output based on conditions provided -f \[exited=<int>\] --latest=false Show the latest created container, -n=-1 Show n last created containers, \--no-trunc=false Don't truncate output --quiet=false Only display numeric IDs lists Only container ID \-s, --size=false Display total file sizes --since= Show created since Id or Name Include non-running lists the containers created after a container, taking the container name and ID as parametersCopy the code

9. Docker RMI removes one or more specified images from the local server.

Docker rmi nginx: latest ubuntu: 14.04Copy the code

The above command means to remove the latest nginx image and ubuntu 14.04 image.

Parameters:

-f, --force=false Force removal of the image --no-prune=false Do not delete untagged parents Do not remove the process image, even if it is being usedCopy the code

10. docker rm

Removes one or more specified containers from the local directory.

docker rm harrysun/lnmp
docker rm -l webapp/redis
Copy the code

Remove the local harrysun/ LNMP container and remove the network connection from the WebApp /redis container.

Parameters:

-f, --force=false Force the removal of a running container (uses SIGKILL) -l, --link=false Remove the specified link --volumes=false Remove the volumes associated with the containerCopy the code

11. docker history

View the creation history of a specified mirror.

Docker history - H harrysun/LNMP: 0.1Copy the code

View the history of the harrysun/ LNMP :0.1 image.

-H, --human=true Print sizes and dates in human readable format \--no-trunc=false Don truncate output Display the full commit record -q, --quiet=false Only show numeric IDs Lists Only the commit record IDsCopy the code

12. docker start|stop|restart

Starts, stops, and restarts one or more specified containers.

docker start -i b5e08e1435b3
Copy the code

Start a container with ID B5E08E1435B3 and enter interactive mode.

Parameters:

-a, --attach=false attach STDOUT/STDERR and signals start a container and print output results and errors \-i, --interactive=false Attach container's STDIN start a container and enter interactive mode -t, --time\=10 Seconds to wait for stop before killing the container, before the system kills the process.Copy the code

13. docker kill

Kills one or more specified container processes.

docker kill -s KILL 94c6b3c3f04a
Copy the code

KILL a container with ID 94C6B3C3F04a and send a KILL signal to the container.

Parameters:

-s, --signal=KILL signal to send to the container Indicates the signal that is sent to the containerCopy the code

14. docker events

Pulls personal dynamics from the server for an optional time interval.

docker events --since="20150720" --until\="20150808"
Copy the code

The above command means to pull the personal dynamics of the individual from 07/20, 2015 to 08/08, 2015.

Parameters:

-f, --filter=\[\] filter output based on conditions provided\--since= Show all events created since timestamp \--until\= Stream events until this timestamp End timeCopy the code

15. docker save

Save the specified image as a tar archive, the reverse of Docker load. Saved-loaded images do not lose commit history and layers and can be rolled back.

Docker save -o ubuntu14.04.tar Ubuntu :14.04Copy the code

The above command means to save the image Ubuntu :14.04 as a file called ubuntu14.04.tar.

Parameters:

-o, --output= Write to an file, instead of STDOUT The output fileCopy the code

16. docker load

Loads an image from a tar image archive, the reverse of Docker save. Saved-loaded images do not lose commit history and layers and can be rolled back.

Docker load -i ubuntu14.04. TarCopy the code

The above command means to load the ubuntu14.04.tar file into the image.

Parameters:

-i, --input= Read from a tar archive file, instead of the tar file loaded by STDINCopy the code

17. docker export

Save the specified container as a tar archive, the reverse of docker import. Exported imported containers lose all of their commit history and cannot be rolled back.

Docker export -o ubuntu14.04.tar 94c6b3C3f04aCopy the code

The above command means to save the container with ID 94c6b3C3f04a as a file named Ubuntu14.04.tar.

Parameters:

  -o, --output=      Write to a file, instead of STDOUT
Copy the code

18. docker import

Create an image from the archive (supporting remote files,.tar,.tar.gz,.tgz,.bzip,.tar.xz,.txz). The reverse of export can be used to label the imported image. Exported imported containers lose all of their commit history and cannot be rolled back.

Cat. / ubuntu14.04. Tar | sudo docker import - ubuntu: 14.04Copy the code

The above command means to create an image of Ubuntu :14.04 using the./ubuntu14.04.tar file, which is pulled remotely by default.

19. docker top

View a running container process with the ps command argument supported.

20. docker inspect

Check the parameters of the mirror or container. The default value is JSON. (the Template)

Docker inspect --format '{{.dockerversion}}' Ubuntu :14.04Copy the code

Return the docker version of ubuntu:14.04 image

Parameters:

-f, --format= format the output using the given Go template Specifies the template file that returns the valueCopy the code

21. docker pause

Pause all processes in a container.

22. docker unpause

Restore all processes of a container.

23. docker tag

Tag the local image and place it in a repository.

Sudo Docker tag 5DB5F8471261Copy the code

Mark container 5db5f8471261 as harrysun/ LNMP :0.2 image.

Parameters:

-f, --force=false Force overwrites the existing flagCopy the code

24. docker push

Push the image to a remote repository, which defaults to Docker Hub.

Docker push harrysun/LNMP: 0.2Copy the code

Push harrysun/ LNMP :0.2 image to remote device

25. docker logs

Gets the output log of the container run time.

docker logs -f --tail 10 94c6b3c3f04a
Copy the code

The above command means to trace the latest 10 logs of the container with ID 94c6B3C3F04a.

Parameters:

-f, --follow=false follow log output --since= Show logs since timestamp \ t, -- timeStamps =false Show timestamps of a container log --tail\=all Number of lines to Show from the end of the logs only lists the latest N container logsCopy the code

26. docker run

Starts a container in which the specified command is run.

Docker run -i -t ubuntu:14.04 /bin/bashCopy the code

The above command means to start a container with an Ubuntu :14.04 image, run it in interactive mode, and reassign a pseudo input terminal to the container.

Arguments :(this command has a lot of arguments, just some of them)

-a, --attach=\[\] attach to STDIN, STDOUT or STDERR --add-host=\[\] add a custom host-to-ip mapping (host: IP) \--blkio-weight=0 Block IO (relative weight), between 10 and 1000 -c, --cpu-shares=0 CPU shares (relative weight) \--cap-add=\[\] Add Linux capabilities \--cap-drop=\[\] Drop Linux capabilities \--cgroup-parent= Optional parent cgroup for the container \--cidfile= Write the container ID to the file --cpu-period=0 Limit CPU CFS (Completely Fair Scheduler) period \--cpu-quota=0 Limit the CPU CFS quota \--cpuset-cpus= CPUs in which to allow execution (0\-3, 0,1) bind a container to a specified CPU run \--cpuset-mems= mems in which to allow execution (0\-3, \-d, --detach=false Run container in background and print container ID Container ID \--device=\[\] Add a host device to the container \-- DNS =\[\] Set custom DNS Servers --dns-search=\[\] Set custom DNS search domains The default is consistent with the host \-e, --env\=\[\] Set environment variables \-- entryPoint = Overwrite the default entrypoint of the image \--env\-file\=\[\] Read in a file of environment variables \--expose=\[\] expose a port or a range of ports \-h, --hostname\= Container hostname\ --help=false Print usage \-i, --interactive=false Keep STDIN open even if not attached \--ipc= IPC namespace to use \-l, --label=\[\] Set meta data on a container \--label-file\=\[\] Read in a line delimited file of labels \--link=\[\] Add link to another container \--log-driver= Logging driver for container \--log-opt=\[\] Log driver options \--lxc-conf=\[\] Add custom lxc options \-m, --memory= Memory limit \--mac-address= Container MAC address (e.g. 92:d0:c6:0a:29:33) \--memory-swap= Total memory (memory + swap), '\-1' to disable swap \--name= Assign a name to the container \--net=bridge Set the Network mode for the Container Specifies the network connection type of the container. Support bridge/host/none/container: < name > | id four types - kill \ \ - oom - disable = false disable oom Killer \ -p, --publish-all=false Publish all exposed ports to random ports \-p, --publish=\[\] Publish a container's port(s) to the host --pid= PID namespace to use \--privileged=false Give extended privileges to this container \--read-only=false Mount the container's root filesystem as read only --restart=no Restart policy to apply when a container exits \--rm\=false Automatically remove the container when it exits \--security-opt=\[\] Security Options \--sig-proxy=true Proxy received signals to the process \-t, --tty=false Allocate a pseudo-tty --tty reallocates a pseudo-input terminal to the container, usually in combination with -i \-u, --user= Username or UID (format: <name|uid>\[:<group|gid>\]) \--ulimit=\[\] Ulimit options \--uts= UTS namespace to use \-v, --volume=\[\] Bind mount a volume \--volumes-from=\[\] Mount volumes from the specified container(s) \-w, --workdir= Working directory inside the containerCopy the code

Here for the time being, any questions, welcome to leave a message at any time ~ ~