first, the new and start the container
Usage:docker Run [OPTIONS] IMAGE [COMMAND] [ARG ...]
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/83/0D/wKioL1dp7qmCLz9VAAKYkvj7mGk419.jpg "title=" Qq20160622094845.jpg "alt=" Wkiol1dp7qmclz9vaakykvj7mgk419.jpg "/>
The following command launches a bash terminal, which allows the user to interact with the meaning of some of these options, please refer to the help above:
Docker Run-ti Jdeathe/centos-ssh/bin/bash
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/83/0D/wKioL1dp7_XA35qkAADJ17DsR70763.jpg "title=" Qq20160622095447.jpg "alt=" Wkiol1dp7_xa35qkaadj17dsr70763.jpg "/>
Docker ps-a can view the current container's running state, and when we exit directly with exit, the container is automatically signaled, because for the Docker container, when the running app bash exits, the container does not need to continue running.
More often, you need to let the Docker container run behind the daemon. Users can do this by adding the-D parameter.
The port of the container can be mapped by the-p parameter, and I am here to map the container's port 22 to the 8022 port of the host.
Docker run-d-P 8022:22 jdeathe/centos-ssh
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/83/0F/wKiom1dp9-LwjMkEAABtXyQeJWw169.jpg "title=" Qq20160622102839.jpg "alt=" Wkiom1dp9-lwjmkeaabtxyqejww169.jpg "/>
Ii. Termination of the container
Usage:docker stop [OPTIONS] CONTAINER [CONTAINER ...]
Third, enter the container
When the-d parameter is used, the container starts to enter the background, the user cannot see the information in the container, and at some point we need to go inside the container, and Docker provides a handy tool for exec.
Usage:docker exec [OPTIONS] CONTAINER COMMAND [ARG ...]
Docker Exec-ti 86e/bin/bash
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/83/0F/wKiom1dp-r_DpA2DAACUrjhZ1C8289.jpg "title=" Qq20160622104038.jpg "alt=" Wkiom1dp-r_dpa2daacurjhz1c8289.jpg "/>
Iv. removing containers
Usage:docker RM [OPTIONS] CONTAINER [CONTAINER ...]
V. Import and Export containers
Usage:docker export [OPTIONS] CONTAINER
Usage:docker import [OPTIONS] url|-[Repository[:tag]
This article is from the "Little Water Drop" blog, please make sure to keep this source http://wangzan18.blog.51cto.com/8021085/1791618
The core concept of Docker--the container