Use separate openrc init script for containerd
The current init script spawns both a docker process **and** a containerd process. This probably confuses openrc which sometimes leads to a crashed docker service when running `/etc/init.d/docker start`.  
Gentoo Linux ships with a separate init script for containerd. By adding the dependency to the docker init script, both processes can be monitored separately by openrc.  

Probably related issue: #23628

---

Related bug for Gentoo Linux [#842567](https://bugs.gentoo.org/842567)

The current docker init file does not specify containerd as dependency. When the docker service is started, it first starts containerd itself. You can check this by
```
rc-service docker stop
rc-service containerd stop
dockerd
```
-> output that indicates that both docker and containerd are started. Htop shows containerd as child process of dockerd.

There exists a separate init script for containerd which is always there when docker is installed because app-containers/containerd (to which the file belongs) is pulled in as a dependency of docker.

When starting the containerd service before docker, the already existing process is used. You can check this by
```
rc-service docker stop
rc-service containerd start
dockerd
```
-> output that indicates that only dockerd is started. Containerd is a separate process.
contrib/init/openrc/docker.initd
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

command="${DOCKERD_BINARY:-/usr/bin/dockerd}"
pidfile="${DOCKER_PIDFILE:-/run/${RC_SVCNAME}.pid}"
command_args="-p \"${pidfile}\" ${DOCKER_OPTS}"
DOCKER_LOGFILE="${DOCKER_LOGFILE:-/var/log/${RC_SVCNAME}.log}"
DOCKER_ERRFILE="${DOCKER_ERRFILE:-${DOCKER_LOGFILE}}"
DOCKER_OUTFILE="${DOCKER_OUTFILE:-${DOCKER_LOGFILE}}"
start_stop_daemon_args="--background \
	--stderr \"${DOCKER_ERRFILE}\" --stdout \"${DOCKER_OUTFILE}\""

extra_started_commands="reload"

rc_ulimit="${DOCKER_ULIMIT:--c unlimited -n 1048576 -u unlimited}"

retry="${DOCKER_RETRY:-TERM/60/KILL/10}"

start_pre() {
	checkpath -f -m 0644 -o root:docker "$DOCKER_LOGFILE"
}

reload() {
	ebegin "Reloading ${RC_SVCNAME}"
	start-stop-daemon --signal HUP --pidfile "${pidfile}"
	eend $? "Failed to stop ${RC_SVCNAME}"
}

#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

command="${DOCKERD_BINARY:-/usr/bin/dockerd}"
pidfile="${DOCKER_PIDFILE:-/run/${RC_SVCNAME}.pid}"
command_args="-p \"${pidfile}\" ${DOCKER_OPTS}"
DOCKER_LOGFILE="${DOCKER_LOGFILE:-/var/log/${RC_SVCNAME}.log}"
DOCKER_ERRFILE="${DOCKER_ERRFILE:-${DOCKER_LOGFILE}}"
DOCKER_OUTFILE="${DOCKER_OUTFILE:-${DOCKER_LOGFILE}}"
start_stop_daemon_args="--background \
	--stderr \"${DOCKER_ERRFILE}\" --stdout \"${DOCKER_OUTFILE}\""

extra_started_commands="reload"

rc_ulimit="${DOCKER_ULIMIT:--c unlimited -n 1048576 -u unlimited}"

retry="${DOCKER_RETRY:-TERM/60/KILL/10}"

depend() {
	need containerd
}

start_pre() {
	checkpath -f -m 0644 -o root:docker "$DOCKER_LOGFILE"
}

reload() {
	ebegin "Reloading ${RC_SVCNAME}"
	start-stop-daemon --signal HUP --pidfile "${pidfile}"
	eend $? "Failed to stop ${RC_SVCNAME}"
}

Done.