码迷,mamicode.com
首页 > 其他好文 > 详细

docker2-容器的使用

时间:2019-09-16 23:51:06      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:comm   als   mes   bsp   span   http   start   docker   state   

 

[root@ipha-dev71-1 chenjl]# docker
[root@ipha-dev71-1 chenjl]# docker pull training/webapp
[root@ipha-dev71-1 chenjl]# docker run -d -P training/webapp python app.py
[root@ipha-dev71-1 chenjl]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                     NAMES
f48e38ee81a9        training/webapp     "python app.py"     15 seconds ago      Up 10 seconds       0.0.0.0:32768->5000/tcp   sweet_brown
[root@ipha-dev71-1 chenjl]# docker run -d -p 5000:5000 training/webapp python app.py
69fbb799c3d5bf4526cbcca9505519ec18c0bdb010301c533c779e47f351e96a
[root@ipha-dev71-1 chenjl]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                     NAMES
69fbb799c3d5        training/webapp     "python app.py"     3 seconds ago       Up 2 seconds        0.0.0.0:5000->5000/tcp    magical_khorana
f48e38ee81a9        training/webapp     "python app.py"     55 minutes ago      Up 55 minutes       0.0.0.0:32768->5000/tcp   sweet_brown
[root@ipha-dev71-1 chenjl]# docker logs -f 69fbb799c3d5
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
^C
[root@ipha-dev71-1 chenjl]# docker top magical_khorana
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                104711              104694              0                   22:53               ?                   00:00:00            python app.py
[root@ipha-dev71-1 chenjl]# docker inspect magical_khorana
[
    {
        "Id": "69fbb799c3d5bf4526cbcca9505519ec18c0bdb010301c533c779e47f351e96a",
        "Created": "2019-09-16T14:53:21.107783511Z",
        "Path": "python",
        "Args": [
            "app.py"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
...
[root@ipha-dev71-1 chenjl]# docker stop magical_khorana
magical_khorana
[root@ipha-dev71-1 chenjl]# docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
69fbb799c3d5        training/webapp     "python app.py"     4 minutes ago       Exited (137) 26 seconds ago                       magical_khorana
[root@ipha-dev71-1 chenjl]# docker rm magical_khorana 
magical_khorana

 

docker2-容器的使用

标签:comm   als   mes   bsp   span   http   start   docker   state   

原文地址:https://www.cnblogs.com/wang-mengmeng/p/11530856.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!