docker命令

作者: think_lonely | 来源:发表于2017-05-17 17:33 被阅读3次

1.建立镜像
docker build -t friendlyname . # Create image using this directory's Dockerfile
2.运行friendlyhello,docker内部的端口映射到宿主机的4000,我们访问应用用4000
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
3.后台的方式运行
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
4.查看运行的容器
docker ps # See a list of all running containers
5.停止运行的容器,id通过 docker ps查看
docker stop <hash> # Gracefully stop the specified container
6.查看所有的容器不管是否运行的
docker ps -a # See a list of all containers, even the ones not running

  1. 强制杀死指定的容器
    docker kill <hash> # Force shutdown of the specified container
    8.从机器移除指定的容器
    docker rm <hash> # Remove the specified container from this machine
    9.移除机器所有的容器
    docker rm $(docker ps -a -q) # Remove all containers from this machine
    10.显示本机包含的所有的镜像
    docker images -a # Show all images on this machine
    11.从本季移除制定的镜像
    docker rmi <imagename> # Remove the specified image from this machine
    12.从本机移除所有的镜像
    docker rmi $(docker images -q) # Remove all images from this machine
    13.cli下登录docker帐号
    docker login # Log in this CLI session using your Docker credentials
    14.标记要上传到仓库的镜像
    docker tag <image> username/repository:tag # Tag <image> for upload to registry
    15.推送docker镜像到仓库
    docker push username/repository:tag # Upload tagged image to registry
    16.从仓库运行docker镜像
    docker run username/repository:tag # Run image from a registry

docker stack ls # List all running applications on this Docker host
docker stack deploy -c <composefile> <appname> # Run the specified Compose file
docker stack services <appname> # List the services associated with an app
docker stack ps <appname> # List the running containers associated with an app
docker stack rm <appname> # Tear down an application

相关文章

  • 记录一次Docker的学习

    Docker学习 Docker概述 Docker安装 Docker命令镜像命令容器命令操作命令... Docker...

  • Docker

    Docker学习目标 Docker概述 Docker安装 Docker命令镜像命令容器命令操作命令... Dock...

  • Docker命令

    Docker命令总结: 帮助命令: docker version docker info docker --hel...

  • Docker常用命令

    Docker常用命令 Docker帮助命令 docker version:查看docker版本 docker in...

  • Docker 之 HAProxy + Django + Redi

    Docker 简介 Docker子命令分类 Docker 命令结构 Docker Architecture Ins...

  • dokcer命令帮助手册

    基础命令 docker version docker help docker info 镜像命令 docker i...

  • Docker 常用命令

    Docker 常用命令 镜像命令 docker images docker search docker pull ...

  • Docker的安装及基础命令

    一、概述 1.1. 学习路径 Docker概述 Docker安装 Docker命令镜像命令容器命令操作命令... ...

  • docker 命令

    一、Docker的基础命令 二、docker网络管理相关的命令: docker run 命令参数 三、docker...

  • 3.Docker 的常用命令

    概况 如何获得docker命令的帮助 docker 的常用命令 Docker命令使用帮助 Docker Clien...

网友评论

    本文标题:docker命令

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