Docker 安装

1. Install Docker

Install latest Docker on Ubuntu 14.04:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
aptitude update; aptitude -y install lxc-docker


or just run below one command:

wget -qO- https://get.docker.com/ | sh


for "docker info" with warning "No swap limit support":

sed -i 's,GRUB_CMDLINE_LINUX_DEFAULT="",GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1",g' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
reboot


CentOS 7.1:
add CentOS 7.1-Extras repository

yum -y install docker; systemctl start docker; systemctl enable docker


install latest docker on CentOS 7(此版本运行ubuntu image有问题):

vi docker.repo
[virt7-release]
name=virt7-release
baseurl=http://cbs.centos.org/repos/virt7-release/x86_64/os/
enabled=1
gpgcheck=0


yum -y install docker; systemctl start docker; systemctl enable docker


CentOS 6.6:
add EPEL repository

yum -y install docker-io; service docker start


install latest docker on CentOS6:

vi docker.repo

[docker-epel-testing]

name=docker-epel-testing

baseurl=http://mirrors.aliyun.com/epel/testing/6/x86_64/

enabled=1
gpgcheck=0


yum -y install docker-io; service docker start


for "docker info" with warning "No swap limit support":

add "cgroup_enable=memory swapaccount=1" to kernel line within /etc/grub.conf
reboot


2. 使用overlay文件系统 --Ubuntu 14.04:

升级kernel至3.18以上以及Docker 1.4或者更高版本

参考http://hj192837.blog.51cto.com/655995/1623333

echo 'DOCKER_OPTS="-s overlay"' >> /etc/default/docker

service docker restart

docker info


使用overlay文件系统 --CentOS7.1:(使用overlay运行ubuntu image有问题)

升级kernel至3.18以上以及Docker 1.4或者更高版本

参考http://hj192837.blog.51cto.com/655995/153932

vi /etc/sysconfig/docker

OPTIONS='--selinux-enabled -s overlay'

systemctl restart docker

docker info


使用overlay文件系统 --CentOS6.6:

升级kernel至3.18以上以及Docker 1.4或者更高版本

参考http://hj192837.blog.51cto.com/655995/153932

sed -i 's,other_args=,other_args="-s overlay",g' /etc/sysconfig/docker

service docker restart

docker info


3. 使用Daocloud国内Mirror:

Ubuntu:

vi /etc/default/docker

DOCKER_OPTS="--registry-mirror=http://xxxxxx.m.daocloud.io"
service docker restart


docker pull ubuntu

docker run -dt ubuntu or docker run -it ubuntu


CentOS7.1:

vi /etc/sysconfig/docker

OPTIONS='--selinux-enabled --registry-mirror=http://xxxxxx.m.daocloud.io'

systemctl restart docker
docker pull ubuntu

docker run -dt ubuntu or docker run -it ubuntu


CentOS6:

vi /etc/sysconfig/docker

other_args="--registry-mirror=http://xxxxx.m.daocloud.io"

service docker restart


docker pull ubuntu

docker run -dt ubuntu or docker run -it ubuntu



你可能感兴趣的:(docker)