Docker: Cannot start service adminer: Unknown runtime specified

Starting docker, you may encounter the following error:

ERROR: for px-cm-identity-db-adminer  Cannot start service adminer: Unknown runtime specified /gnu/store/ljj06wrwv0zd0yhldr1r0gkiyydqxrvf-runc-1.0.0-rc93/sbin/runc

Fix #1

Sometimes it’s enough for Docker to re-create the container:

docker-compose up --build --force-recreate

If that did not work, try #2.

Fix #2

Here’s how you find your current Docker runtime:

$ docker info
...
 Runtimes: /gnu/store/d7v1k8va1b31m6vq0cvs6bbsxhgqrv4z-runc-1.0.0-rc93/sbin/runc
 Default Runtime: /gnu/store/d7v1k8va1b31m6vq0cvs6bbsxhgqrv4z-runc-1.0.0-rc93/sbin/runc
 Init Binary: /gnu/store/j9s5gblvzn5zckx84w8zx7ldazyj54qk-tini-0.19.0/bin/tini-static
...

Next, figure out the ID of the offending container:

$ docker ps -a | grep adminer
f7772590577c        adminer                           "entrypoint.sh docke…"   3 months ago        Exited (255) About an hour ago   0.0.0.0:8080->8080/tcp   px-cm-identity-db-adminer

Alright, f77725...

$ ls /var/lib/docker/containers/ | grep f7772590577c
f7772590577cf93b2a936c40552a7cd5705f2667f9bc639ed286101f5b39651f/

You will have to proceed as root from here:

su - root

Now we’ll open the hostconfig.json in nano, and look for "Runtime" and replace it with the value we got from docker info.

Before:

# /var/lib/docker/containers/f7772590577cf93b2a936c40552a7cd5705f2667f9bc639ed286101f5b39651f/hostconfig.json
"Runtime":"/gnu/store/ljj06wrwv0zd0yhldr1r0gkiyydqxrvf-runc-1.0.0-rc93/sbin/runc",

After:

"Runtime":"/gnu/store/d7v1k8va1b31m6vq0cvs6bbsxhgqrv4z-runc-1.0.0-rc93/sbin/runc",

Next we’ll restart the Docker service. This seems necessary to pickup the change.

herd restart dockerd

Now you can try to start your container again.
Sometimes you may be greeted by another error related to above change:

ERROR: for adminer  Cannot start service adminer: mkdir /run/containerd/io.containerd.runtime.v1.linux/moby/8b2fafcf0a961f4fa49a82b3060030b6bc7bb27bd6dc51ccb6b7b71257dbc3bd: file exists: unknown

I’ve found that simply removing this file works without data loss:

rm -rf /run/containerd/io.containerd.runtime.v1.linux/moby/8b2fafcf0a961f4fa49a82b3060030b6bc7bb27bd6dc51ccb6b7b71257dbc3bd

That’s it. Simply run as usual.