Skip to content

Docker Issue with Fn UI Grafana Prometheus Lab

Michael J Williams edited this page Mar 1, 2018 · 2 revisions

Docker Issue with Fn UI/Grafana/Prometheus Lab

Problem

When I run this command

docker run --rm --name=prometheus -d -p 9090:9090 -v `pwd`/prometheus.yml:/etc/prometheus/prometheus.yml --add-host="fnserver:`docker network inspect bridge -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}'`" prom/prometheus

Docker attempts to pull down the Prometheus images. The following log and error message is produced:

Unable to find image 'prom/prometheus:latest' locally
latest: Pulling from prom/prometheus
aab39f0bc16d: Already exists 
a3ed95caeb02: Already exists 
2cd9e239cea6: Already exists 
48afad9e6cdd: Already exists 
8fb7aa0e1c16: Already exists 
3b9d4fd63760: Already exists 
57a87cf4a659: Already exists 
9a31588e38ae: Already exists 
7a0ac0080f04: Already exists 
659e24e6d37f: Already exists 
Digest: sha256:aae7f9829bbbba8f98b3ebd4f2b5c47c09ed8f2e47a4f3022cae5aed546a4c3c
Status: Downloaded newer image for prom/prometheus:latest
docker: Error response from daemon: Conflict. The container name "/prometheus" is already in use by container "9d6e65cad892c5aeb8466b135a3a3d80fb63b5feda23341fd75c54d4a442a62e". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

Prometheus fails to start. The docker ps command shows you no Prometheus image is running. When you do a docker image command, there is an image:

prom/prometheus      latest              c8ecf7c719c1        5 weeks ago         112MB

Removing the image with docker rmi image does not fix the problem. It just repeats.

Solution

The problem appears to be caused by cached intermediate images stored on your system. To find and clear all images perform the following commands.

  1. docker rmi $(docker images -a --filter=dangling=true -q)
    • Cleans any dangling images. Intermediate images left from multiple builds.
  2. docker ps --filter=status=exited --filter=status=created -q
    • Cleans any stopped images. These apparently do not show up in docker images.
  3. docker rmi $(docker images -a -q)
    • Removes any normal images.

After running these two commands, your cached images should be gone.

Running the original command should now work.

Clone this wiki locally