Docker —— 从入门到实践

http://udn.yyuap.com/doc/docker_practice/introduction/index.html

非常详细的Docker学习教程

https://blog.csdn.net/zmx729618/article/details/72930474/

Docker入门实战

https://yuedu.baidu.com/ebook/d817967416fc700abb68fca1?pn=1&rf=https%3A%2F%2Fyuedu.baidu.com%2Fsearch%3Fword%3Ddocker%26pbook%3D0

Docker for Mac 安装

https://docs.docker.com/docker-for-mac/install/

基本概念:

Docker 包括三个基本概念

  • 镜像(Image)

  • 容器(Container)

  • 仓库(Repository)

Docker 镜像就是一个只读的模板。

例如:一个镜像可以包含一个完整的 ubuntu 操作系统环境,里面仅安装了 Apache 或用户需要的其它应用程序。

镜像可以用来创建 Docker 容器。

Docker 提供了一个很简单的机制来创建镜像或者更新现有的镜像,用户甚至可以直接从其他人那里下载一个已经做好的镜像来直接使用。

Docker 利用容器来运行应用。

容器是从镜像创建的运行实例。它可以被启动、开始、停止、删除。每个容器都是相互隔离的、保证安全的平台。

可以把容器看做是一个简易版的 Linux 环境(包括root用户权限、进程空间、用户空间和网络空间等)和运行在其中的应用程序。

仓库是集中存放镜像文件的场所。有时候会把仓库和仓库注册服务器(Registry)混为一谈,并不严格区分。实际上,仓库注册服务器上往往存放着多个仓库,每个仓库中又包含了多个镜像,每个镜像有不同的标签(tag)。

仓库分为公开仓库(Public)和私有仓库(Private)两种形式。

最大的公开仓库是 Docker Hub,存放了数量庞大的镜像供用户下载。 国内的公开仓库包括 Docker Pool等,可以提供大陆用户更稳定快速的访问。

当然,用户也可以在本地网络内创建一个私有仓库。

当用户创建了自己的镜像之后就可以使用 push 命令将它上传到公有或者私有仓库,这样下次在另外一台机器上使用这个镜像时候,只需要从仓库上 pull 下来就可以了。

基本命令:

查找镜像     sudo docker search ubuntu:14.04

下载镜像    sudo docker pull ubuntu:14.04

显示本地镜像   sudo  docker images

创建容器    sudo docker run --name test -it ubuntu:14.04 /bin/bash    -d命令可用于后台运行容器   -p 用于端口映射  -p 8140 或者 -p 8140:8080两种用法

修改容器后保存为新的镜像    sudo docker commit -a "zc" -m "my ubuntu" 593672a640ef ubuntu:base

利用Dockerfile创建镜像    sudo docker build

从本地系统导入    sudo docker import

上传镜像    sudo docker push

存出镜像    sudo docker save -o ubuntu_14.04.tar ubuntu:14.04

载入镜像  sudo docker load --input ubuntu_14.04.tar
移除容器  sudo docker rm test

移除镜像    sudo docker rmi ubuntu:14.04

开始/停止/杀死容器    sudo docker start/stop/kill

连接到已有的容器    sudo docker exec -it 5936 /bin/bash

Commands:

attach      Attach to a running container

build       Build an image from a Dockerfile

commit      Create a new image from a container's changes

cp          Copy files/folders between a container and the local filesystem

create      Create a new container

deploy      Deploy a new stack or update an existing stack

diff        Inspect changes to files or directories on a container's filesystem

events      Get real time events from the server

exec        Run a command in a running container

export      Export a container's filesystem as a tar archive

history     Show the history of an image

images      List images

import      Import the contents from a tarball to create a filesystem image

info        Display system-wide information

inspect     Return low-level information on Docker objects

kill        Kill one or more running containers

load        Load an image from a tar archive or STDIN

login       Log in to a Docker registry

logout      Log out from a Docker registry

logs        Fetch the logs of a container

pause       Pause all processes within one or more containers

port        List port mappings or a specific mapping for the container

ps          List containers

pull        Pull an image or a repository from a registry

push        Push an image or a repository to a registry

rename      Rename a container

restart     Restart one or more containers

rm          Remove one or more containers

rmi         Remove one or more images

run         Run a command in a new container

save        Save one or more images to a tar archive (streamed to STDOUT by default)

search      Search the Docker Hub for images

start       Start one or more stopped containers

stats       Display a live stream of container(s) resource usage statistics

stop        Stop one or more running containers

tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

top         Display the running processes of a container

unpause     Unpause all processes within one or more containers

update      Update configuration of one or more containers

version     Show the Docker version information

wait        Block until one or more containers stop, then print their exit codes

1.docker学习的更多相关文章

  1. Docker学习总结

    本文作为总结性文章,不会详细讲解Docker.但会把已学习的.了解的内容按照由易到难的顺序串起来,更多的是帮助Docker新手快速的了解Docker,知道目前处在哪个阶段,接下来该学些什么,避免碰太多 ...

  2. Docker学习笔记 — 配置国内免费registry mirror

    Docker学习笔记 — 配置国内免费registry mirror Docker学习笔记 — 配置国内免费registry mirror

  3. docker学习笔记1 -- 安装和配置

    技术资料 docker中文官网:http://www.docker.org.cn/ 中文入门课程:http://www.docker.org.cn/book/docker.html docker学习笔 ...

  4. docker学习资料整理(持续更新中..)

    docker最近可以说火得一踏糊涂,跟 51大神在交流技术的时候这个东西会多次被提到,当我们还玩vm+linux/freebsd的时候,人家已经上升到更高层次了,这就是差距,感觉好高大上的样子,技术之 ...

  5. Docker学习笔记之一,搭建一个JAVA Tomcat运行环境

    Docker学习笔记之一,搭建一个JAVA Tomcat运行环境 前言 Docker旨在提供一种应用程序的自动化部署解决方案,在 Linux 系统上迅速创建一个容器(轻量级虚拟机)并部署和运行应用程序 ...

  6. Docker学习总结之Run命令介绍

    Docker学习总结之Run命令介绍 本文由Vikings(http://www.cnblogs.com/vikings-blog/) 原创,转载请标明.谢谢! 在使用Docker时,执行最多的命令某 ...

  7. docker~学习笔记索引

    回到占占推荐博客索引 使用docker也有段时间了,写了不少文章与总结,下面把它整理个目录出来,方便大家去学习与检索! docker~学习笔记索引 docker~linux下的部署和基本命令(2017 ...

  8. Docker学习笔记 - Docker容器内部署redis

    Docker学习笔记(2-4)Docker应用实验-redist server 和client的安装使用 一.获取redis容器(含客户端和服务端) 二.创建服务端容器 1.在终端A中运行redis- ...

  9. docker学习笔记(一)—— ubuntu16.04下安装docker

    docker学习笔记(一)—— ubuntu16.04下安装docker 原创 2018年03月01日 14:53:00 标签: docker / ubuntu 1682 本文开发环境为Ubuntu ...

  10. Docker 学习8 Dockerfile详解2

    一.继续上章节Docker学习7 CMD命令后. 11.ENTRYPOINT a.容器启动后相当于会启动ENTRYPOINT + CMD 命令,CMD相当于参数传给entrypoint的 [root@ ...

随机推荐

  1. Uva 组装电脑 12124 - Assemble

    主要运用二分法查找最优解 #include<iostream> #include<string> #include<vector> #include<map& ...

  2. js中的日期

    创建日期对象: var date1 = new Date(2018, 11,10)  第二个参数传入的是月份,月份是0-11,实际上要加1 获得现在的时间:var date2 = Date.now() ...

  3. k8s的pv和pvc简述

    pvc:资源需要指定:1.accessMode:访问模型:对象列表:    ReadWriteOnce – the volume can be mounted as read-write by a s ...

  4. 02 python网络爬虫《Http和Https协议》

    一.HTTP协议 1.概念: Http协议就是服务器(Server)和客户端(Client)之间进行数据交互(相互传输数据)的一种形式. 之间形成的特殊行话(黑话:(土匪)天王盖地虎,(我)宝塔镇河妖 ...

  5. Essential C++ 3.1 节的代码练习——哨兵方式

    #include "IncrementArray.hpp" template <typename element> element *find_address(elem ...

  6. [转]Git for windows 下vim解决中文乱码的有关问题

    Git for windows 下vim解决中文乱码的问题 原文链接:Git for windows 下vim解决中文乱码的有关问题 1.右键打开Git bash: 2.cd ~ 3.vim .vim ...

  7. HBase官方文档

    HBase官方文档 目录 序 1. 入门 1.1. 介绍 1.2. 快速开始 2. Apache HBase (TM)配置 2.1. 基础条件 2.2. HBase 运行模式: 独立和分布式 2.3. ...

  8. 57、android 应用内全局通知的实现方法

    1.后台运行一个服务 间隔5s从服务器获取一次数据,根据业务需要,当需要提醒给用户时,从右侧自动划出 类似效果如下:在任何界面都会有通知弹窗 2.实现过程   ①android的根布局叫dector( ...

  9. leetcode 【 Pascal's Triangle II 】python 实现

    题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [ ...

  10. Android App程序结构

    先看结构图: ====================================== 1.   /src   源码目录,不解释. 2.  /gen   gen目录是ADT 自动生成的代码所在位置 ...