Flannel and docker don't start - docker

I'm trying to set up a kubernetes cluster on 2 nodes , centos 7.1 using this guide. However when I attempt to start the services on the minion like so:
for SERVICES in kube-proxy kubelet docker flanneld; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
I get the following error:
-- Logs begin at Wed 2015-12-23 13:00:41 UTC, end at Wed 2015-12-23 16:03:54 UTC. --
Dec 23 16:03:47 sc-test2 systemd[1]: docker-storage-setup.service: main process exited, code=exited, status=1/FAILURE
Dec 23 16:03:47 sc-test2 systemd[1]: Failed to start Docker Storage Setup.
-- Subject: Unit docker-storage-setup.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker-storage-setup.service has failed.
--
-- The result is failed.
Dec 23 16:03:47 sc-test2 systemd[1]: Unit docker-storage-setup.service entered failed state.
Dec 23 16:03:48 sc-test2 flanneld[36477]: E1223 16:03:48.187350 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:49 sc-test2 flanneld[36477]: E1223 16:03:49.189860 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:50 sc-test2 flanneld[36477]: E1223 16:03:50.192894 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:51 sc-test2 flanneld[36477]: E1223 16:03:51.194940 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:52 sc-test2 flanneld[36477]: E1223 16:03:52.197222 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:53 sc-test2 flanneld[36477]: E1223 16:03:53.199248 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
Dec 23 16:03:54 sc-test2 flanneld[36477]: E1223 16:03:54.201160 36477 network.go:53] Failed to retrieve network config: 100: Key not found (/atomic.io)
I'm sure I set the key on the master with :
etcdctl mk /coreos.com/network/config '{"Network":"172.17.0.0/16"}'
By far installation seems to be the hardest bit on using kubernetes :(

Today's christmas but I spent the whole day trying to get this to work :) This is what I did:
#1 FLANNEL
As mentioned I'd set the flannel etcd key on the master with:
etcdctl mk /coreos.com/network/config '{"Network":"172.17.0.0/16"}'
but I got this error when trying to start flannel on the minion:
Failed to retrieve network config: 100: Key not found (/atomic.io)
So I edited the /etc/sysconfig/flanneld file on the minion from:
# Flanneld configuration options
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD="http://master:2379"
# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_KEY="/coreos.com/network"
# Any additional options that you want to pass
#FLANNEL_OPTIONS=""
to:
# Flanneld configuration options
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD="http://master:2379"
# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_KEY="/atomic.io/network"
# Any additional options that you want to pass
#FLANNEL_OPTIONS=""
i.e. changed the FLANNEL_ETCD key.
After this systemctl start flanneld worked.
#2 DOCKER
I didn't find a way to make the version installed as a dependency by kubernetes work so I uninstalled it and following the docker docs for Centos installed docker-engine and manually created a docker.service file for systemctl.
cd /usr/lib/systemd/system
and the contents of the docker.service:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
Requires=flanneld.service
After=flanneld.service
[Service]
EnvironmentFile=/etc/sysconfig/flanneld
ExecStart=/usr/bin/docker daemon -H fd:// --bip=${FLANNEL_SUBNET}
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
then start and enable the daemon with systemctl as well as query the status.
systemctl restart docker
systemctl enable docker
systemctl status docker

Related

minikube kubernetes configuration

I am new to kubernetes Having issue while installing minikube.
Hypervisor: virtualbox 6
Base OS centos 7
docker version 19.03.5
kubectl version v1.16.3
minikube version v1.5.2
firewalld stopped
iptables flushed
selinux disabled
steps to reproduce:
step 1: intsall kubectl (using binaries)
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
Step 2: install minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
install minikube /usr/local/bin
Step3: start minikube
minikube start --vm-driver=none
1) output:
minikube v1.5.2 on Centos 7.2.1511
Tip: Use 'minikube start -p ' to create a new cluster, or 'minikube delete' to delete this one.
Using the running none "minikube" VM ...
Waiting for the host to be provisioned ...
Preparing Kubernetes v1.16.2 on Docker '19.03.5' ...
Relaunching Kubernetes using kubeadm ...
X Error restarting cluster: waiting for apiserver: apiserver process never appeared
2) minikube logs:
* Nov 22 07:08:40 localhost.localdomain kubelet[13807]: F1122 07:08:40.236946 13807 server.go:196] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error kubelet config file "/var/lib/kubelet/config.yaml" was empty
* Nov 22 07:08:40 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
* Nov 22 07:08:40 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
* Nov 22 07:08:40 localhost.localdomain systemd[1]: kubelet.service failed.
* Nov 22 07:08:40 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
* Nov 22 07:08:40 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
* Nov 22 07:08:40 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
* List item
As per my understanding /var/lib/kubelet directory was not created although kuberlet package is installed so is there anything wrong with the steps or do i have to dcreate these directory and files manually.

Kuberntes master not starting up in OpenStack heat

I have been trying to setup a Kubernetes cluster for the last week or so in OpenStack using this guide. I have faced a few issues in the process one of which is described in this question -> kube-up.sh failes in OpenStack
On issuing the ./cluster/kube-up.sh script, it tries to bring up the cluster using the openstack stack create step (Log) . Here, for some reason the kubernetes master does not properly come up and here is where the installation fails. I was able to SSH into the master node and found this in /var/log/cloud-init-output.log
[..]
Complete!
* INFO: Running install_centos_stable_post()
* INFO: Running install_centos_check_services()
* INFO: Running install_centos_restart_daemons()
* INFO: Running daemons_running()
* INFO: Salt installed!
2017-01-02 12:57:31,574 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
2017-01-02 12:57:31,576 - util.py[WARNING]: Running scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
Cloud-init v. 0.7.5 finished at Mon, 02 Jan 2017 12:57:31 +0000. Datasource DataSourceOpenStack [net,ver=2]. Up 211.20 seconds
On digging further I found this snippet in the /var/log/messages file -> https://paste.ubuntu.com/23733430/
So I would assume that the Docker daemon is not starting up. Also there is something screwed up with my etcd configuration due to which flanneld service is also not starting up. Here is the output of service flanneld status
● flanneld.service - Flanneld overlay address etcd agent
Loaded: loaded (/usr/lib/systemd/system/flanneld.service; enabled; vendor preset: disabled)
Active: activating (start) since Tue 2017-01-03 13:32:37 UTC; 48s ago
Main PID: 15666 (flanneld)
CGroup: /system.slice/flanneld.service
└─15666 /usr/bin/flanneld -etcd-endpoints= -etcd-prefix= -iface=eth0 --ip-masq
Jan 03 13:33:16 kubernetesstack-master flanneld[15666]: E0103 13:33:16.229827 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:17 kubernetesstack-master flanneld[15666]: E0103 13:33:17.230082 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:18 kubernetesstack-master flanneld[15666]: E0103 13:33:18.230326 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:19 kubernetesstack-master flanneld[15666]: E0103 13:33:19.230560 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:20 kubernetesstack-master flanneld[15666]: E0103 13:33:20.230822 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:21 kubernetesstack-master flanneld[15666]: E0103 13:33:21.231325 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:22 kubernetesstack-master flanneld[15666]: E0103 13:33:22.231581 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:23 kubernetesstack-master flanneld[15666]: E0103 13:33:23.232140 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:24 kubernetesstack-master flanneld[15666]: E0103 13:33:24.234041 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
Jan 03 13:33:25 kubernetesstack-master flanneld[15666]: E0103 13:33:25.234277 15666 network.go:53] Failed to retrieve network config: client: etcd cluster is unavailable or misconfigured
My etcd daemon is running:
[root#kubernetesstack-master salt]# netstat -tanlp | grep etcd
tcp 0 0 192.168.173.3:4379 0.0.0.0:* LISTEN 20338/etcd
tcp 0 0 192.168.173.3:4380 0.0.0.0:* LISTEN 20338/etcd
Although its running on a non standard port.
I'm also in a corporate network under a proxy. Any pointers on how to debug this further is appreciated. As of now I have reached a dead end on how to proceed on this. Asking in the kubernetes slack channels have also produced zero results!
/usr/bin/flanneld -etcd-endpoints=
That line is the source of your troubles, assuming you didn't elide the output before posting it. Your situation is made worse by etcd running on non-standard ports, but thankfully I think the solution to both of those is actually the same fix.
I would expect running systemctl cat flanneld.service (you may need sudo, depending on the strictness of your systemd setup) to output the unified systemd descriptor for flanneld, including any "drop-ins", overrides, etc, and if my theory is correct, one of them will be either Environment= or EnvironmentFile= and that's the place I bet flanneld.service expected to have ETCD_ENDPOINTS= or FLANNELD_ETCD_ENDPOINTS= (as seen here) available to the Exec.
So hopefully that file is either missing or is actually blank, and in either case you are one swift vi away from teaching flanneld about your etcd endpoints, and everything being well in the world again.

Job for docker.service failed because the control process exited with error code

So I installed docker engine on RHEL 7
Now when I do a
service docker start
I get the following error:
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
and when I go to "systemctl status docker.service" and "journalctl -xe"
I get:
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/docker.service.d
└─docker.conf
Active: failed (Result: exit-code) since Thu 2016-09-08 22:15:53 EDT; 10s ago
Docs: https://docs.docker.com
Process: 13504 ExecStart=/usr/bin/docker daemon -H fd:// --mtu 1400 --exec-opt native.cgroupdriver=systemd (code=exited, status=1/FAILURE)
Main PID: 13504 (code=exited, status=1/FAILURE)
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: Starting Docker Application Container Engine...
Sep 08 22:15:53 app-linux2.app-netapp.lab.com docker[13504]: time="2016-09-08T22:15:53.227074798-04:00" level=fatal msg="no sockets found via socket activation: make sure the service ...by systemd"
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: Failed to start Docker Application Container Engine.
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: Unit docker.service entered failed state.
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: docker.service failed.
And
--
-- The start-up result is done.
Sep 08 22:10:01 app-linux2.app-netapp.lab.com CROND[12753]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Sep 08 22:10:01 app-linux2.app-netapp.lab.com systemd[1]: Starting Session 58 of user root.
-- Subject: Unit session-58.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-58.scope has begun starting up.
Sep 08 22:10:53 app-linux2.app-netapp.lab.com polkitd[766]: Registered Authentication Agent for unix-process:12878:2674931 (system bus name :1.173 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Sep 08 22:10:53 app-linux2.app-netapp.lab.com systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has begun starting up.
Sep 08 22:10:53 app-linux2.app-netapp.lab.com docker[12895]: time="2016-09-08T22:10:53.413304246-04:00" level=fatal msg="no sockets found via socket activation: make sure the service was started by
Sep 08 22:10:53 app-linux2.app-netapp.lab.com systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Sep 08 22:10:53 app-linux2.app-netapp.lab.com systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Sep 08 22:10:53 app-linux2.app-netapp.lab.com systemd[1]: Unit docker.service entered failed state.
Sep 08 22:10:53 app-linux2.app-netapp.lab.com systemd[1]: docker.service failed.
Sep 08 22:10:53 app-linux2.app-netapp.lab.com polkitd[766]: Unregistered Authentication Agent for unix-process:12878:2674931 (system bus name :1.173, object path /org/freedesktop/PolicyKit1/Authent
Sep 08 22:13:36 app-linux2.app-netapp.lab.com polkitd[766]: Registered Authentication Agent for unix-process:13214:2691210 (system bus name :1.174 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Sep 08 22:13:36 app-linux2.app-netapp.lab.com polkitd[766]: Unregistered Authentication Agent for unix-process:13214:2691210 (system bus name :1.174, object path /org/freedesktop/PolicyKit1/Authent
Sep 08 22:15:53 app-linux2.app-netapp.lab.com polkitd[766]: Registered Authentication Agent for unix-process:13489:2704913 (system bus name :1.175 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has begun starting up.
Sep 08 22:15:53 app-linux2.app-netapp.lab.com docker[13504]: time="2016-09-08T22:15:53.227074798-04:00" level=fatal msg="no sockets found via socket activation: make sure the service was started by
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: Unit docker.service entered failed state.
Sep 08 22:15:53 app-linux2.app-netapp.lab.com systemd[1]: docker.service failed.
Sep 08 22:15:53 app-linux2.app-netapp.lab.com polkitd[766]: Unregistered Authentication Agent for unix-process:13489:2704913 (system bus name :1.175, object path /org/freedesktop/PolicyKit1/Authent
lines 3473-3523/3523 (END)
I tried to search solution for this
but could not find any.
Just Remove Docker Lib and restart it again with:
sudo rm -rf /var/lib/docker
then
sudo systemctl enable docker
sudo systemctl start docker
Check your OS logs files for warning or error messages.
Probably you have made a mistake in the config files of docker and when the service starts it gets an error.
The log's location depends on your OS.
On Linux system logs are often in:
/var/log/daemon.log
/var/log/docker
/var/log/messages
/var/log/syslog
/var/log/upstart/docker.log
Some useful linux console commands to inspect docker logs:
sudo systemctl status docker.service
sudo journalctl -fu docker.service
cat /var/log/daemon.log | grep docker
cat /var/log/messages | grep docker
If you are using Windows this article might be helpful
Here are more details
What version of Docker do you use? If you are not locked to the elder one, consider use of the most recent version (currently it's 1.12). Here's my startup options (Debian 8, /etc/systemd/system/docker.service):
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Type=notify
ExecStart=/usr/bin/docker daemon -H fd:// --dns=10.240.116.7 --dns 8.8.8.8 --bip=172.17.42.1/24
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
Also try to start Docker in debug mode (-D) without systemd, just like if it was a common program. This will help to find out why daemon doesn't start.
Fixing the Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details. problem, for me this worked:
create daemon.json in /etc/docker/
put this in it:
{
"exec-root": "/path/to/docker/run",
"storage-driver": "overlay",
"graph": "/path/to/docker/lib"
}
then try: docker daemon
reboot
docker run hello-world should succeed now
There are many reasons for docker service failing to run. One of them that I encountered is using single quotes instead of double quotes for the key value pairs in the json file.
It fails
sudo cat > /etc/docker/daemon.json << '_EOF'
{
'registry-mirrors': ['https://docker.io']
}
_EOF
It works!
sudo cat > /etc/docker/daemon.json << '_EOF'
{
"registry-mirrors": ["https://docker.io"]
}
_EOF
For more info see here
I came across same issue in my Linux VM(virtual machine).
System details : ubuntu 18.04
I had to just delete my daemon.json and then do a service docker start this worked for me.
Note: I had put insecure registry in my daemon.json file and i didn't want that as well hence i deleted it. I don't know it's usage though.

fail to upgrade docker on redhat7

Currently docker 1.7.1 was installed on my machine, I want to upgrade it to latest version by below steps.
1. service docker stop
2. wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O /usr/bin/docker
3. service docker start
But I met issues when I executed the third step.
[root#xxx ~]# service docker start
Redirecting to /bin/systemctl start docker.service
Job for docker.service failed. See 'systemctl status docker.service' and 'journalctl -xn' for details.
Then I execute the two command to get more info like below
[root#xxxxx ~]# systemctl status docker.service
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
Active: failed (Result: exit-code) since Thu 2015-12-24 21:18:20 EST; 22s ago
Docs: http://docs.docker.com
Process: 28160 ExecStart=/usr/bin/docker -d $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=2)
Main PID: 28160 (code=exited, status=2)
Dec 24 21:18:20 abc.host.com systemd[1]: Starting Docker Application Container Engine...
Dec 24 21:18:20 abc.host.com docker[28160]: Warning: '-d' is deprecated, it will be removed soon. See usage.
Dec 24 21:18:20 abc.host.com docker[28160]: flag provided but not defined: --add-registry
Dec 24 21:18:20 abc.host.com docker[28160]: See '/usr/bin/docker --help'.
Dec 24 21:18:20 abc.host.com systemd[1]: docker.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 24 21:18:20 abc.host.com systemd[1]: Failed to start Docker Application Container Engine.
Dec 24 21:18:20 abc.host.com systemd[1]: Unit docker.service entered failed state.
[root#xxxxx ~]# journalctl -xn
-- Logs begin at Mon 2015-12-07 06:26:15 EST, end at Thu 2015-12-24 21:18:20 EST. --
Dec 24 21:18:20 abc.host.com systemd[1]: docker-storage-setup.service: main process exited, code=exited, status=1/FAILURE
Dec 24 21:18:20 abc.host.com systemd[1]: Failed to start Docker Storage Setup.
-- Subject: Unit docker-storage-setup.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker-storage-setup.service has failed.
--
-- The result is failed.
Dec 24 21:18:20 abc.host.com systemd[1]: Unit docker-storage-setup.service entered failed state.
Dec 24 21:18:20 abc.host.com systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has begun starting up.
Dec 24 21:18:20 abc.host.com docker[28160]: Warning: '-d' is deprecated, it will be removed soon. See usage.
Dec 24 21:18:20 abc.host.com docker[28160]: flag provided but not defined: --add-registry
Dec 24 21:18:20 abc.host.com docker[28160]: See '/usr/bin/docker --help'.
Dec 24 21:18:20 abc.host.com systemd[1]: docker.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 24 21:18:20 abc.host.com systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Dec 24 21:18:20 abc.host.com systemd[1]: Unit docker.service entered failed state.
RHEL bundles its own version of the Docker daemon with additional command line options like --add-registry. See also https://access.redhat.com/articles/1354823.
The systemd scripts on RHEL are modeled around the RHEL Docker daemon and its additional options. If you drop in a Docker release directly from Docker.com, you will get startup issues. You either need to modify the systemd scripts or you need to stick to the official RHEL and CentOS upgrade channels.
This is mentioned in issue 17566
the 1.9 rpms now bundle a selinux policy: http://yum.dockerproject.org/repo/testing/centos/7/Packages/
created docker repo using http://yum.dockerproject.org/repo/testing/centos/7/Packages/ and successfully installed and started latest docker-engine.
Note: you can use also http://yum.dockerproject.org/repo/main/centos/7/Packages/, which include the latest 1.9.1 official package for CentOS.
rpm -qa | grep docker
yum install -y http://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-1.9.1-1.el7.centos.x86_64.rpm

After installing docker on centos7,Failed to start docker."Job for docker.service failed."

After executing yum install docker on centos7, I want to start docker by executing service docker start, then i can see the error:
Redirecting to /bin/systemctl start docker.service
Job for docker.service failed. See 'systemctl status docker.service' and 'journalctl -xn' for details.
then I execute systemctl status docker.service -l, then the error is:
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
Active: failed (Result: exit-code) since Sun 2015-03-15 03:49:49 EDT; 12min ago
Docs: http://docs.docker.com
Process: 11444 ExecStart=/usr/bin/docker -d $OPTIONS $DOCKER_STORAGE_OPTIONS (code=exited, status=1/FAILURE)
Main PID: 11444 (code=exited, status=1/FAILURE)
Mar 15 03:49:48 localhost.localdomain docker[11444]: 2015/03/15 03:49:48 docker daemon: 1.3.2 39fa2fa/1.3.2; execdriver: native; graphdriver:
Mar 15 03:49:48 localhost.localdomain docker[11444]: [a25f748b] +job serveapi(fd://)
Mar 15 03:49:48 localhost.localdomain docker[11444]: [info] Listening for HTTP on fd ()
Mar 15 03:49:48 localhost.localdomain docker[11444]: [a25f748b] +job init_networkdriver()
Mar 15 03:49:48 localhost.localdomain docker[11444]: [a25f748b] -job init_networkdriver() = OK (0)
Mar 15 03:49:49 localhost.localdomain docker[11444]: 2015/03/15 03:49:49 write /var/lib/docker/init/dockerinit-1.3.2: no space left on device
Mar 15 03:49:49 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Mar 15 03:49:49 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Mar 15 03:49:49 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
I really have no idea, looking forward to your response, I will be very appreciative!
this error usually occurs because of missing device-mapper-event-libs package.
# yum install device-mapper-event-libs
Thanks for Ben Whaley's advice,When I check my disk space,Indeed it's not enough.I extend my disk space and solve the problem. It's the first time I put forward questions,It's really of help. thanks again.
I upgraded the CentOS 7 kernel from 3 to 4.
NOTE: I upgraded Kernel for other reasons also, first try without upgrading kernel.
delete the folder docker under /var/lib
go to cd /etc/sysconfig
vi docker (before editing copy docker docker.org)
see Line there you find OPTIONS='--selinux-disabled --log-driver=journald'
Remove --selinux-disabled should like OPTIONS='--log-driver=journald'
Now un-comment # setsebool -P docker_transition_unconfined 1 to setsebool -P docker_transition_unconfined 1
reboot the machine or you try only docker start to check for me it works :)

Resources