The core concept of Docker--the container

Source: Internet
Author: User
Tags docker ps docker run

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

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.