Basic use of Docker containers

Source: Internet
Author: User
Tags docker ps

Previous Docker installation: http://wangjiatong.blog.51cto.com/11834370/1885951

    1. To start the container:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8C/12/wKioL1hhEiqCUJV-AAB3hUG1xhs308.png-wh_500x0-wm_3 -wmp_4-s_3797455628.png "title=" start. png "alt=" wkiol1hheiqcujv-aab3hug1xhs308.png-wh_50 "/>

$docker runubuntu echo "Hello"

[sudo] password for tong: enter password

Hello

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8C/12/wKioL1hhEpXg4pBWAAC19OtgkDw459.png-wh_500x0-wm_3 -wmp_4-s_3504437921.png "title=" Start 1.png "alt=" Wkiol1hhepxg4pbwaac19otgkdw459.png-wh_50 "/>

[Email protected]:~ $docker run-it Ubuntu/bin/bash into interactive

[Email protected]:/#exit Exit Interactive

2. View containers

(1) Docker PS [-a][-l]-A: List all containers,-l: List newly created containers

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8C/12/wKioL1hhFCuwyEy0AAEzGAxhcOA329.png-wh_500x0-wm_3 -wmp_4-s_1173054760.png "title=" 1.png "alt=" Wkiol1hhfcuwyey0aaezgaxhcoa329.png-wh_50 "/>

(2) Docker inspect name (or ID) view container for more detailed information

$ docker inspect44f381be24db ( or container's name Ubuntu)

[{

"Apparmorprofile": "",

"Args": [],

"Config": {

"Attachstderr": true,

"Attachstdin": true,

"Attachstdout": true,

。。。。。

3. Customizing the generated container

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8C/12/wKioL1hhFH3CM4TDAABxqibQYGA133.png-wh_500x0-wm_3 -wmp_4-s_306532580.png "title=" 2.png "alt=" Wkiol1hhfh3cm4tdaabxqibqyga133.png-wh_50 "/>

$ docker run--name=ubuntu -it Ubuntu/bin/bash

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8C/16/wKiom1hhFMignIMgAABwWg38vas957.png-wh_500x0-wm_3 -wmp_4-s_307616043.png "title=" 3.png "alt=" Wkiom1hhfmignimgaabwwg38vas957.png-wh_50 "/>

$ docker InspectUbuntu ( can see the container information generated by this command )

4. Restart the stopped container:

$docker start [i] container name

$ docker start-i ubuntu ( start the last stopped container )

[Email protected] 343de151118d:/#

5. Remove the stopped container:
$docker RM container Name (or the first 4 characters of an ID)

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/8C/16/wKiom1hhFgui2xxRAAF_tpdd6rQ015.png-wh_500x0-wm_3 -wmp_4-s_653406375.png "title=" 4.png "alt=" Wkiom1hhfgui2xxraaf_tpdd6rq015.png-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/8C/12/wKioL1hhFjyAoi0AAAElkHV14eU618.png-wh_500x0-wm_3 -wmp_4-s_45682351.png "title=" 5.png "alt=" Wkiol1hhfjyaoi0aaaelkhv14eu618.png-wh_50 "/>

you can see the container without the 142fe8dbc6d9.


This article from "Do not forget Beginner's mind" blog, reproduced please contact the author!

Basic use of Docker containers

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.