Skip to content

Instantly share code, notes, and snippets.

@dyndna
Created April 7, 2015 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dyndna/c321546e0ba6742984c7 to your computer and use it in GitHub Desktop.
Save dyndna/c321546e0ba6742984c7 to your computer and use it in GitHub Desktop.
[Solved] docker does not run on cent os 6.6

Issue:

Upon sudo service docker start, docker daemon fails to start with tail /var/log/docker showing following error:

time="2015-04-07T00:28:43Z" level="info" msg="+job serveapi(unix:///var/run/docker.sock)" 
time="2015-04-07T00:28:43Z" level="info" msg="WARNING: You are running linux kernel version 2.6.32-504.12.2.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0." 
time="2015-04-07T00:28:43Z" level="info" msg="Listening for HTTP on unix (/var/run/docker.sock)" 
time="2015-04-07T00:28:45Z" level="fatal" msg="Error loading device metadata file .tmp529617825" 

Possible reasons for having this kind of error:

  • accidental deletion of /var/run/docker.sock
    • ifconfig fails to show network socker named, docker0
    • Upon sudo service docker stop, /var/run/docker.pid and /var/lock/subsys/docker (if present) persist and require manual deletion.
    • yum reinstall or yum remove followed by yum install for package, docker-io and its depdendencies does not solve the issue.
    • System reboot does not solve the issue.
    • Kernel version 2.6.32-431 or higher is required for running docker on Cent OS 6.5 or higher.

Potential fix:

  • Stop docker service, sudo service docker stop && sudo rm /var/run/docker.pid && sudo rm /var/lock/subsys/docker
  • Look at tail /var/log/docker and if error similar to Error loading device metadata file .tmp529617825 appears, then remove culprit file(s) at /var/lib/docker/devicemapper/metadata/.tmpxxxxxxx
  • Look at ifconfig and if docker0 network socket is absent, then make/edit following file:
cat << EOF | sudo tee /etc/sysconfig/network-scripts/ifcfg-docker0
DEVICE=docker0
ONBOOT=yes
TYPE=Bridge
NETMASK=255.255.0.0
IPADDR=172.88.0.1
STP=off
DELAY=0
EOF
  • Reinstall docker and update kernel to version 2.6.32-431 or more.
# Use package remove command with caution, especially if you have other softwares dependent on one or more of these packages.
sudo yum remove docker-io bridge-utils device-mapper device-mapper-libs libudev lua-alt-getopt lua-filesystem lua-lxc lxc lxc-libs
sudo yum update # use with caution or only update kernel-firmware and kernel-headers.
sudo yum install docker-io
sudo usermod -a -G docker <user> # To allow user running docker without sudo privileges.
  • Reboot system

DO NOT start docker service before system reboot and making sure ifconfig has docker0 socket.

Restart docker services:

sudo service docker start

More at https://docs.docker.com/installation/centos/#starting-the-docker-daemon

END

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment