How can I run the Docker container after it runs out?

Source: Internet
Author: User
Tags docker ps docker run
Phenomenon

Start the Docker container
Docker Run–name [Container_name] [container_id]
View Container Run status
Docker Ps-a
Find out Why the Mydocker container has just started

The main thread of the Docker container (the command executed by CMD in dockfile) ends and the container exits the method

You can use the interactive boot

Docker run-i [Container_name or container_id]

The above is not very friendly, we recommend using background mode and TTY options

Docker Run-dit [Container_name or container_id]

View container Status

Docker Ps-a

Docker brings up the background container

Docker attach [Container_name or container_id]

TIPs: When exiting, use [Ctrl + D], this will end the current Docker thread, the container ends, you can use [Ctrl + P][ctrl + Q] to exit without terminating the container run

The command is executed in the specified container, and [ctrl+d] does not terminate the container when it exits.

Docker exec-it [Container_name or container_id]/bin/bash

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.