Centos 使用 docker

公司linux服务器基本使用的Centos,以下切换为Centos进行docker的操作。

查看系统版本

[root@Sonar-104 ~]# cat /etc/redhat-release 
CentOS release 6.5 (Final)

 

安装docker

  CentOS6

  对于 CentOS6,可以使用 EPEL 库安装 Docker,命令如下

$ sudo yum install http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm
$ sudo yum install docker-io

  CentOS7

  CentOS7 系统 CentOS-Extras 库中已带 Docker,可以直接安装:

$ sudo yum install docker

  安装之后启动 Docker 服务,并让它随系统启动自动加载。

$ sudo service docker start
$ sudo chkconfig docker on

  

Centos 6.5会因为内核问题无法启动docker并报错
WARN[0000] You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0.
解决办法:
yum upgrade device-mapper-libs 

  

  查看docker进程是否启动:

ps -aux | grep docker

  

 docker监听内网的配置文件/etc/sysconfig/docker内容:

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# from the atomic-registries package.
#

# docker-latest daemon can be used by starting the docker-latest unitfile.
# To use docker-latest client, uncomment below lines
#DOCKERBINARY=/usr/bin/docker-latest
#DOCKERDBINARY=/usr/bin/dockerd-latest
#DOCKER_CONTAINERD_BINARY=/usr/bin/docker-containerd-latest
#DOCKER_CONTAINERD_SHIM_BINARY=/usr/bin/docker-containerd-shim-latest

  

posted @ 2017-11-10 13:55  YatHo  Views(467)  Comments(0Edit  收藏  举报