您的位置:首页 > 运维架构 > Docker

docker安装

2015-10-13 17:27 686 查看

docker安装

Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。 —— [ 百度百科 ]

测试环境

ubuntu 14.04 server版本 64位系统1

事先操作

更新apt-get源

vim /etc/apt/sources.list


将aliyun源写入该文件

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://mirrors.aliyuncs.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyuncs.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyuncs.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyuncs.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyuncs.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyuncs.com/ubuntu/ trusty-backports main restricted universe multiverse


然后执行命令,更新软件包 并备份文件

apt-get update

cp /etc/apt/sources.list /mnt/source.list


安装docker

官方的方法在[]https://docs.docker.com/installation/ubuntulinux/],这里就不做介绍了。我这里推荐一个国内比较快速的安装方法2.

curl -sSL https://get.daocloud.io/docker | sh


下面,我们就可以使用docker命令了,docker运行在后台的程序.

service docker start|restart|stop|status


只有在服务启动的时候才可以正常使用docker命令3,所以我们得出这个是一个C/S的程序,一个服务端 一个客户端交互运行。

Dockerfile4

我这里简单说明sources.list5在Dockerfile怎么使用:

将备份的sources.list备份到/mnt/ 目录下

cd  /mnt
vim Dockerfile


# VERSION 0.0.1
# 默认ubuntu server长期支持版本,当前是12.04
FROM ubuntu:latest
# 签名啦
MAINTAINER cuisongliu"cuisongliu@qq.com"
#覆盖docker主机中的apt源
ADD  sources.list  /etc/apt/sources.list
# 更新源,安装ssh server
RUN apt-get update


:wq
docker build  -t  docker/aliyun


docker支持的系统为64位系统,32位系统需要更多操作.
https://dashboard.daocloud.io/runtimes/new 在这里注册帐号可以添加主机监控,更快的pull镜像.
docker build|pull|push|kill|load|tag
等等命令,输入docker COMMAND –help即可查看
http://blog.csdn.net/wsscy2004/article/details/25878223# 这里有具体说明.
这里更换docker主机里的源是因为,第一次build的时候会先从远程pull一次,如果没有国内源或者网络比较好的源地址的话会卡在build的时候.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: