美文网首页
常用命令

常用命令

作者: 恒忏 | 来源:发表于2017-12-28 08:53 被阅读0次
    yum install docker
    systemctl restart docker
    systemctl enable docker
    docker pull faci/langs4:ver01
    

    docker pull 可能因为传说中的 GFW 失败...
    可以配置 docker 如下并 systemctl restart docker:

    20170928101752178.png

    Docker Cmd:

    删除:

    docker ps -a
    
    docker rm MyImageNameToDelete
    docker rmi MyImageNameToDelete
    
    docker rm -v $(docker ps -aq)
    docker rm -v $(docker ps -aq -f status=exited)
    

    停止正在运行的容器

    sudo docker stop $(sudo docker ps -q)
    

    删除(已经停止的,正在运行的不能删除)容器

    sudo docker rm $(sudo docker ps -a -q)
    

    运行:

    docker run -it ubuntu /bin/bash
    

    CREATE IMAGE:

    *** from a running container's ID:

    docker commit container_ID xxx/xxx:888.888
    docker commit f48aa95869d8 centos_golang:version1
    

    *** upload to hub.docker.com:
    1 sign up as: faci:some_password,888888@qq.com
    2 create repo: langs4
    3 docker tag xxx/xxx:888.888 faci/langs4:ver01
    4 docker push faci/langs4:ver01

    *** download from hub.docker.com:

    docker pull faci/langs4:ver01
    

    参数:
    -c=1024 cpu 100%
    -c=10 cpu 1%
    -m=32M ram max value 限制内存32M,好像16M 就编译不了啦.
    -v /host/dir:/container/path v:volume.挂载到容器.
    -it 交互模式
    -d 后台模式(Detached mode)
    -rm 删除容器

    How to install golang under CentOs:

    yum install go
    curl -LO https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz
    tar -C /usr/local -xvzf go1.9.2.linux-amd64.tar.gz
    mkdir -p ~/projects/{bin,pkg,src}
    cd ~/projects
    vi ~/.bash_profile
    source /etc/profile && source ~/.bash_profile
    vi ~/projects/src/hello.go
    go install $GOPATH/hello.go
    $GOBIN/hello
    

    相关文章

      网友评论

          本文标题:常用命令

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