When life's bad on Docker...

Russell Bateman
December 2018
last update:

This is where I'm going to jot down bad stuff that happens to me and how I fix it.

When life's bad on Docker...

...and other useful tips!

I keep doing this to myself. I reboot, then the Filebeat container won't come up. I use a /tmp link to /home/russ/dev/logs. That's gone when I bounce my box and I forget to recreate it. Then, after despairing and begging for help, I see this:

russ@moria:~/dev/orchestration$ docker service ls
ID            NAME           MODE         REPLICAS  IMAGE
42uuxvag1d9g  acme-consul    replicated   1/1       artifactory.acme.net/consul:latest
yyf85gi8qrnx  acme_filebeat  global       0/1       artifactory.acme.net/acme-filebeat:latest
.
.
.
russ@moria:~/dev/orchestration$ docker service ps acme_filebeat
ID            NAME                                        DESIRED STATE  CURRENT STATE                     ERROR
6sxuqgstde6g  acme_filebeat.fw17z9s7l7lx5ukvcka04epzj     Ready          Preparing less than a second ago
qnnu4tainvq6  \_ acme_filebeat.fw17z9s7l7lx5ukvcka04epzj  Shutdown       Rejected 3 seconds ago            "invalid mount config for type..."
ytirpcbev5p9  \_ acme_filebeat.fw17z9s7l7lx5ukvcka04epzj  Shutdown       Rejected 8 seconds ago            "invalid mount config for type..."
sj5su4rc6r20  \_ acme_filebeat.fw17z9s7l7lx5ukvcka04epzj  Shutdown       Rejected 13 seconds ago           "invalid mount config for type..."
w0yze0zlqbmd  \_ acme_filebeat.fw17z9s7l7lx5ukvcka04epzj  Shutdown       Rejected 18 seconds ago           "invalid mount config for type..."

"Invalid mount config for type..." is code for, "Duh, are you trying to mount something that doesn't even exist?" It asks the question, "What's in your docker-compose.yaml file?"

More "when life's bad on Docker"...

I don't know how to look for every error yet:

task: non-zero exit(1)

Is this EPERM? I haven't changed anything; what does the container have no permissions to touch/do?

russ@moria:~/dev/orchestration$ docker service ps acme_filebeat
ID            NAME                                        IMAGE                      NODE   DESIRED STATE CURRENT STATE         ERROR
bmj1te600mbe  \_ acme_filebeat.fw17z9s7l7lx5ukvcka04epzj  .../acme-filebeat:latest   moria  Shutdown      Failed 2 seconds ago  "task: non-zero exit (1)"

Look at the container logs:

russ@moria:~/dev/orchestration$ docker-ps
e470135464dc  artifactory.acme.net/acme-filebeat:latest   Created
6205b9d64e57  artifactory.acme.net/acme-filebeat:latest   Exited (1) 5 seconds ago
2d8d8b49d933  artifactory.acme.net/acme-filebeat:latest   Exited (1) 12 seconds ago
b18f849d2e78  artifactory.acme.net/acme-filebeat:latest   Exited (1) 20 seconds ago
dd25165456af  artifactory.acme.net/acme-filebeat:latest   Exited (1) 27 seconds ago
russ@moria:~/dev/orchestration$ docker logs 6205b9d64e57
.
.
.
2018-12-21T22:15:34.966Z  ERROR  instance/beat.go:743  Exiting: Error importing Kibana dashboards: fail to create the Kibana loader: Error creat...

Some useful Docker commands...

To stop, then remove a container:
$ docker rm -f container-id

To remove images:
$ docker rmi image-id [ image-ids ]

To gain access to the Docker repository on 10.10.11.239, in
/etc/docker/daemon.json, put these contents:
{
  "insecure-registries" : [ "10.10.11.239:5000" ]
}

$ docker image tag imagename:version ip-address:port/imagename:tag

For example:
$ docker image tag some-image:tag 10.10.11.239:5000/some-image:latest

Tag an image with tag, latest:
$ docker image push 10.10.11.239:5000/some-image:latest

Discard unused Docker image layers (reducing worthless lines in docker image):
$ docker rmi $(docker images --filter "dangling=true" -q --no-trunc)