16boke - 一路博客

centos安装docker

1、配置Fedora EPEL源

yum -y install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm


2、配置hop5.in源

cd /etc/yum.repos.d

wget http://www.hop5.in/yum/el6/hop5.repo


3、安装docker-io

yum -y install docker-io


4、检查安装情况

docker -h

会输出如下内容:

Usage of docker:

  -D=false: Debug mode

  -H=[unix:///var/run/docker.sock]: tcp://host:port to bind/connect to or unix://path/to/socket to use

  -api-enable-cors=false: Enable CORS requests in the remote api.

  -b="": Attach containers to a pre-existing network bridge. Use 'none' to disable container networking

  -d=false: Daemon mode

  -dns="": Set custom dns servers

  -g="/var/lib/docker": Path to graph storage base dir.

  -p="/var/run/docker.pid": File containing process PID

  -r=false: Restart previously running containers

  -v=false: Print version information and quit


5、要想docker正常运行还需要在/etc/fstab里增加cgroup文件系统

echo"none /sys/fs/cgroup cgroup defaults 0 0">>/etc/fstab

mount/sys/fs/cgroup


6、运行docker

输入:service docker start

查看是否运行:service docker status

返回:docker (pid  2302) 正在运行...


7、查看docker的版本

输入:docker version

返回:

Client version: 1.7.1

Client API version: 1.19

Go version (client): go1.4.2

Git commit (client): 786b29d/1.7.1

OS/Arch (client): linux/amd64

Server version: 1.7.1

Server API version: 1.19

Go version (server): go1.4.2

Git commit (server): 786b29d/1.7.1

OS/Arch (server): linux/amd64