开始安装daoker之旅:

1、

[root@localhost ~]# uname -r
2.6.-.el6.x86_64

2、

[root@localhost ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

注意其他的源可能导致你的内核和docker的版本不一致,需要升级内核至3.x。

3、安装

[root@localhost ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.JN76fI: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [%]
:epel-release ########################################### [%]
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-
[root@localhost ~]# yum -y install docker-io
 启动并设置开机自动启动
 
[root@localhost ~]# service docker start
Starting cgconfig service: [确定]
Starting docker: [确定]
[root@localhost ~]# chkconfig docker on
[root@localhost ~]# service docker start
Starting cgconfig service: [确定]
Starting docker: [确定]
[root@localhost ~]# chkconfig docker on
 

获取cnetos镜像

[root@localhost ~]# docker pull centos:latest
centos:latest: The image you are pulling has been verified
511136ea3c5a: Pull complete
5b12ef8fd570: Pull complete
34943839435d: Downloading [===> ] 18.38 MB/232.5 MB 1h7m49s

#官方安装方式docker pull imagename从docker的索引中心下载,imagename是镜像名称,例如docker pull ubuntu就是下载base ubuntu并且tag是latest

我们还可以搜索基于 Fedora 和 Ubuntu 操作系统的容器。

[root@localhost ~]# docker search ubuntu
[root@localhost ~]# docker search fedora

查看docker镜像

[root@localhost ~]# docker images centos
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest 34943839435d Less than a second ago 224 MB
[root@localhost ~]# docker images centos
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest 34943839435d Less than a second ago MB

运行docker运行shell

[root@localhost ~]# docker run -i -t centos /bin/bash
[root@2ce733141ece /]#
[root@2ce733141ece /]#
[root@2ce733141ece /]#
[root@2ce733141ece /]#
[root@localhost ~]# docker run -i -t centos /bin/bash
[root@2ce733141ece /]#
[root@2ce733141ece /]#
[root@2ce733141ece /]#
[root@2ce733141ece /]#

停止容器

[root@localhost ~]# docker stop <CONTAINER ID>

删除所有容器

docker rm $(docker ps -a -q)

查看docker的子命令,直接敲docker 或完整的docker help 就可以

常用命令

总结一下常用命令:

其中<>阔起来的参数为必选,[]阔起来为可选

  • docker version 查看docker的版本号,包括客户端、服务端、依赖的Go等

  • docker info 查看系统(docker)层面信息,包括管理的images, containers数等

  • docker search <image> 在docker index中搜索image

  • docker pull <image> 从docker registry server 中下拉image

  • docker push <image|repository> 推送一个image或repository到registry

  • docker push <image|repository>:TAG 同上,指定tag

  • docker inspect <image|container> 查看image或container的底层信息

  • docker images TODO filter out the intermediate image layers (intermediate image layers 是什么)

  • docker images -a 列出所有的images

  • docker ps 默认显示正在运行中的container

  • docker ps -l 显示最后一次创建的container,包括未运行的

  • docker ps -a 显示所有的container,包括未运行的

  • docker logs <container> 查看container的日志,也就是执行命令的一些输出

  • docker rm <container...> 删除一个或多个container

  • docker rm `docker ps -a -q` 删除所有的container

  • docker ps -a -q | xargs docker rm 同上, 删除所有的container

  • docker rmi <image...> 删除一个或多个image

  • docker start/stop/restart <container> 开启/停止/重启container

  • docker start -i <container> 启动一个container并进入交互模式

  • docker attach <container> attach一个运行中的container

  • docker run <image> <command> 使用image创建container并执行相应命令,然后停止

  • docker run -i -t <image> /bin/bash 使用image创建container并进入交互模式, login shell是/bin/bash

  • docker run -i -t -p <host_port:contain_port> 将container的端口映射到宿主机的端口

  • docker commit <container> [repo:tag] 将一个container固化为一个新的image,后面的repo:tag可选

  • docker build <path> 寻找path路径下名为的Dockerfile的配置文件,使用此配置生成新的image

  • docker build -t repo[:tag] 同上,可以指定repo和可选的tag

  • docker build - < <dockerfile> 使用指定的dockerfile配置文件,docker以stdin方式获取内容,使用此配置生成新的image

  • docker port <container> <container port> 查看本地哪个端口映射到container的指定端口,其实用docker ps 也可以看到

http://www.linuxidc.com/Linux/2014-07/104595.htm

Centos7安装docker 点击这里  http://linux.cn/article-4340-1.html

docker入门与实战点击这里  http://www.dockerpool.com/static/books/docker_practice/index.html

docker到底是什么点击这里  http://cloud.51cto.com/art/201411/457407.htm

CentOS6.5内核升级看这里http://cn.soulmachine.me/blog/page/3/

docker other  http://docker.widuu.com/

CentOS 6/7系列安装Docker http://www.linuxidc.com/Linux/2014-07/104768.htm

Docker的搭建Gitlab CI 全过程详解 http://www.linuxidc.com/Linux/2013-12/93537.htm

Docker安装应用(CentOS 6.5_x64) http://www.linuxidc.com/Linux/2014-07/104595.htm

在 Docker 中使用 MySQL http://www.linuxidc.com/Linux/2014-01/95354.htm

在Ubuntu Trusty 14.04 (LTS) (64-bit)安装Docker http://www.linuxidc.com/Linux/2014-10/108184.htm

Docker安装应用(CentOS 6.5_x64) http://www.linuxidc.com/Linux/2014-07/104595.htm

Ubuntu 14.04安装Docker  http://www.linuxidc.com/linux/2014-08/105656.htm

阿里云CentOS 6.5 模板上安装 Docker http://www.linuxidc.com/Linux/2014-11/109107.htm

Docker 的详细介绍请点这里
Docker 的下载地址请点这里

本文永久更新链接地址http://www.linuxidc.com/Linux/2015-01/111091.htm   

Docker -CentOS 6.5上安装的更多相关文章

  1. Docker 在6.4上安装

      1 在 CentOS 6.4 上安装 docker docker当前官方只支持Ubuntu,所以在 CentOS 安装Docker比较麻烦(Issue #172). docker官方文档说要求Li ...

  2. 在CentOS或RHEL上安装Nux Dextop仓库

    介绍 Nux Dextop是类似CentOS.RHEL.ScientificLinux的第三方RPM仓库(比如:Ardour,Shutter等等).目前,Nux Dextop对CentOS/RHEL ...

  3. CentOS 6.5上安装MySQL-Cluster

    参考博文: CentOS 6.2下MySQL Cluster 7.2 配置数据库集群 CentOS 6.5上安装MySQL-Cluster 7.3.4过程笔记--下一步学习 MySQL Cluster ...

  4. CentOS 6.9上安装mysql-5.6.36

    CentOS 6.9上安装mysql-5.6.36 1.准备数据存放的文件系统 新建一个逻辑卷,并将其挂载至特定目录即可.这里不再给出过程. 这里假设其逻辑卷的挂载目录为/data,而后需要创建/da ...

  5. 记录CentOS 7.4 上安装MySQL&MariaDB&Redis&Mongodb

    记录CentOS 7.4 上安装MySQL&MariaDB&Redis&Mongodb 前段时间我个人Google服务器意外不能用,并且我犯了一件很低级的错误,直接在gcp讲服 ...

  6. [转]在Linux CentOS 6.6上安装Python 2.7.9

    在Linux CentOS 6.6上安装Python 2.7.9 查看python安装版本 python -V yum中最新的也是Python 2.6.6,所以只能下载Python 2.7.9的源代码 ...

  7. 在 CentOS 7.2 上安装 ODOO 10 (2018-10-09 持续更新)

    在 CentOS 7.2 上安装 ODOO 10 更新系统 yum update 安装 EPEL 源 1 yum install -y epel-release 安装依赖组件 yum install ...

  8. CentOS 6.9上安装mysql-5.6.37

    CentOS 6.9上安装mysql-5.6.37 1.准备数据存放的文件系统 新建一个逻辑卷,并将其挂载至特定目录即可.这里不再给出过程. 这里假设其逻辑卷的挂载目录为/data,而后需要创建/da ...

  9. CentOS 6.9上安装Mysql 5.7.18 安装

    CentOS 6.9上安装Mysql 5.7.18 安装 下载地址:https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-linux-g ...

随机推荐

  1. CSS入门之定义和应用格式

    1:定义 1:定义单个属性 property:value 例如: color:white(属性和值之间用冒号隔开) 2:定义多个属性 property:value;property:value 例如: ...

  2. java callable future futuretask

    Runnbale封装一个异步运行的任务,可以把它想象成一个没有任何参数和返回值的异步方法.Callable和Runnable相似,但是它有返回值.Callable接口是参数化的类型,只有一个方法cal ...

  3. notepad++ quicktext插件安装与代码片段配置[quicktext v0.2.1]

    1 下载quicktext插件0.2.1版本 http://sourceforge.net/projects/quicktext/ 2 解压 3 把QuickText.ANSI.dll和QuickTe ...

  4. HDU 2087 剪花布条【在字符串中不可重叠地寻找子串数量】

    一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案.对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?  Input输入中含有一些数据,分别是成对出现的花布条和 ...

  5. cogs p服务点设置

    5. P服务点设置 ★★   输入文件:djsc.in   输出文件:djsc.out   简单对比时间限制:2 s   内存限制:128 MB 问题描述为了进一步普及九年义务教育,政府要在某乡镇建立 ...

  6. Linux命令之groupadd

    groupadd [选项] 组 创建一个新的组.Groupadd命令使用命令行中指定的值加上系统默认值创建新的组账户.新组将根据需要输入系统. (1).选项 -f,--force 如果指定的组已经存在 ...

  7. 记录(Record)

    记录有可以被称为行(Row),可以通俗的认为它是数据表中的一行数据.以员工表为例,一个公司的员工表中的数据是这样的: 这里每一行数据就代表一个员工的资料,这样的一行数据就叫做一条记录.表是由行和列组成 ...

  8. Xamarin XAML语言教程构建ControlTemplate控件模板 (四)

    Xamarin XAML语言教程构建ControlTemplate控件模板 (四) 2.在页面级别中构建控件模板 如果开发者要在页面级别中构建控件模板,首先必须将ResourceDictionary添 ...

  9. luogu P1009 阶乘之和

    题目描述 用高精度计算出S=1!+2!+3!+…+n!(n≤50) 其中“!”表示阶乘,例如:5!=5*4*3*2*1. 输入输出格式 输入格式: 一个正整数N. 输出格式: 一个正整数S,表示计算结 ...

  10. [Contest20180415]看无可看

    题意:有一个数列$f$,对$\forall i\geq2,f_i=2f_{i-1}+3f_{i-2}$,给定$f_0,f_1$,再给定一个集合$S=\{a_{1\cdots n}\}$和$k$,求$\ ...