美文网首页docker容器技术
四、容器的基本操作

四、容器的基本操作

作者: InsaneLoafer | 来源:发表于2021-11-24 12:28 被阅读0次

    容器的基本操作

    image.png

    Demo

    $ docker container run nginx
    $ docker ps
    CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS     NAMES
    343fd4031609   nginx     "/docker-entrypoint.…"   6 seconds ago   Up 5 seconds   80/tcp    xenodochial_clarke
    $ docker container ls
    CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS     NAMES
    343fd4031609   nginx     "/docker-entrypoint.…"   14 seconds ago   Up 13 seconds   80/tcp    xenodochial_clarke
    $ docker container stop 34
    34
    $ docker container ls -a
    CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS                      PORTS     NAMES
    343fd4031609   nginx     "/docker-entrypoint.…"   29 seconds ago   Exited (0) 5 seconds ago              xenodochial_clarke
    d9095daa8bcf   nginx     "/docker-entrypoint.…"   28 minutes ago   Exited (0) 28 minutes ago             suspicious_shamir
    $ docker container rm 34
    34
    $ docker container ls -a
    CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS                      PORTS     NAMES
    d9095daa8bcf   nginx     "/docker-entrypoint.…"   28 minutes ago   Exited (0) 28 minutes ago             suspicious_shamir
    

    相关文章

      网友评论

        本文标题:四、容器的基本操作

        本文链接:https://www.haomeiwen.com/subject/omcbtrtx.html