docker学习笔记(一)——安装

本篇将介绍在docker在windows,macosx,linux上的安装。

目录:

1.windows/macosx安装docker

2.linux安装docker(CentOS and Ubuntu)

3.测试

4.参考资料

1.windows/macosx安装docker

  * Windows 7.1, 8/8.1 or newer with Hardware Virtualization Technology,OS X 10.8 “Mountain Lion” or newer

  1.1.安装docker toolbox(https://www.docker.com/products/docker-toolbox)

  1.2.启动Docker Toolbox terminal

2.linux安装docker(CentOS and Ubuntu)

  * CentOS 7.X,Ubuntu Wily 15.10,Ubuntu Vivid 15.04,Ubuntu Trusty 14.04 (LTS),Ubuntu Precise 12.04 (LTS)

  * 64-bit,kernel 3.10 or newer

  2.1.Ubuntu 15.10

$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

  修改/etc/apt/sources.list.d/docker.list,清空文件内容,添加:

# Ubuntu Wily 15.10
deb https://apt.dockerproject.org/repo ubuntu-wily main

  保存后,在命令行界面:

$ apt-get update
$ apt-get purge lxc-docker
$ apt-cache policy docker-engine

  针对Ubuntu Trusty, Vivid, and Wily,建议安装linux-image-extra:

$ sudo apt-get update
$ sudo apt-get install linux-image-extra-$(uname -r)

  安装docker

$ sudo apt-get update
$ sudo apt-get install docker-engine  --安装docker
$ sudo service docker start   --启动docker

  2.2.CentOS 7.X

  2.2.1.yum安装

$ sudo yum update
$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
$ sudo yum install docker-engine
$ sudo service docker start

  2.2.2.script安装

$ sudo yum update
$ curl -sSL https://get.docker.com/ | sh
$ sudo service docker start

  2.2.3.开机启动

$ sudo chkconfig docker on

3.测试

 $ docker run hello-world

4.参考资料

  http://www.docker.com/

  https://docs.docker.com/windows/

  https://docs.docker.com/mac/

  https://docs.docker.com/engine/installation/centos/

  https://docs.docker.com/engine/installation/ubuntulinux/

你可能感兴趣的:(docker学习笔记(一)——安装)