美文网首页
Docker 安装 Centos

Docker 安装 Centos

作者: BlueFishMan | 来源:发表于2020-05-29 10:52 被阅读0次

    pull

    docker pull centos
    
    Using default tag: latest
    latest: Pulling from library/centos
    8a29a15cefae: Pull complete 
    Digest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700
    Status: Downloaded newer image for centos:latest
    docker.io/library/centos:latest
    

    iamges

    docker images
    
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    centos              latest              470671670cac        4 months ago        237MB
    

    run

    docker run -itd -p 127.0.0.1:80:80 -p 127.0.0.1:443:443 -p 127.0.0.1:3306:3306 -p 127.0.0.1:22:22 --name gas centos
    
    b8ec5e89047dfbe74977bc4d4500a111b454e2d1b8388ae311c87a008377d84
    
    docker exec -it gas /bin/bash
    
    [root@b8ec5e89047d /]#
    

    或者

    docker run -it -p 127.0.0.1:80:80 -p 127.0.0.1:443:443 -p 127.0.0.1:3306:3306 -p 127.0.0.1:22:22 --name gas centos /bin/bash
    
    [root@4eea47e53c46 /]#
    

    ps

    docker ps
    
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                                                                          NAMES
    c6e608855954        centos              "/bin/bash"         49 seconds ago      Up 48 seconds       127.0.0.1:22->22/tcp, 127.0.0.1:80->80/tcp, 127.0.0.1:443->443/tcp, 127.0.0.1:3306->3306/tcp   gas
    
    docker ps -a
    
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    c6e608855954        centos              "/bin/bash"         49 seconds ago      Up 48 seconds       127.0.0.1:22->22/tcp, 127.0.0.1:80->80/tcp, 127.0.0.1:443->443/tcp, 127.0.0.1:3306->3306/tcp   gas
    

    commit

    docker commit -a "bluefishmancn" -m "xampp" 9422805ae69f gas:0.0.1
    sha256:772b717059082b78d8771fd211f8a3d41e0cd4a91241d636f19537ed8509ea0f
    

    tag&push

    docker tag gas:0.0.1 bluefishmancn/gas:0.0.1
    
    docker push bluefishmancn/gas:0.0.1
    

    相关文章

      网友评论

          本文标题:Docker 安装 Centos

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