Docker Learning Notes (ii)

Source: Internet
Author: User
Tags docker stop container

1. Start the container

There are two ways to start a container, one is to create a new container based on the mirror and start, and the other is to restart the container in the terminating state (stopped).

New:

1.docker run centos:6/bin/echo ' Hello World ' #输出一个 "Hello World", then terminates the container

2.docker run-t-I centos:6/bin/bash #启动一个bash终端, allowing users to interact

-tOption lets Docker assign a pseudo terminal (Pseudo-tty) and bind to the container's standard input, -i keeping the container's standard input open.

When used docker run to create a container, the standard operations that Docker runs in the background include:

  • Checks if there is a specified image locally and does not exist to download from the public repository
  • Create and start a container with mirroring
  • Assign a file system and mount a layer of read-write layers outside the mirrored layer
  • Bridging a virtual interface into a container from the bridge interface configured by the host host
  • Configure an IP address from the address pool to the container
  • Executing user-specified applications
  • Container is terminated when execution is complete

Start a container that has been terminated

The command can be used to docker start start a terminated container directly.

Docker start container name Docker stop container name

Docker Learning Notes (ii)

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.