OpenTelemetry docker demo error for otelcol container

Problem

You are trying to set up the OpenTelemetry docker demo application but the otel container fails with errors similar to the followng:

Error: failed to resolve config: cannot resolve the configuration: cannot retrieve the configuration: unable to read the file file:/etc/otelcol-config.yml: open /etc/otelcol-config.yml: permission denied

Error: failed to resolve config: cannot resolve the configuration: cannot retrieve the configuration: unable to read the file file:/etc/otelcol-config-extras.yml: open /etc/otelcol-config-extras.yml: permission denied

Solution

Change the permissions to the two configuration files in src/otelcollector to 644 and then stop and start the container.

Following the log file (docker logs -f otel-col) should have something like the following instead of the previous errors:

2024-01-10T14:44:29.062Z	info	service@v0.91.0/telemetry.go:86	Setting up own telemetry...
2024-01-10T14:44:29.063Z	info	service@v0.91.0/telemetry.go:203	Serving Prometheus metrics	{"address": ":8888", "level": "Basic"}
2024-01-10T14:44:29.064Z	info	exporter@v0.91.0/exporter.go:275	Development component. May change in the future.	{"kind": "exporter", "data_type": "logs", "name": "debug"}
2024-01-10T14:44:29.064Z	info	exporter@v0.91.0/exporter.go:275	Development component. May change in the future.	{"kind": "exporter", "data_type": "traces", "name": "debug"}

sudo kubeadmin init returns with: [ERROR Swap]: running with swap on is not supported. Please disable swap

Problem

You are trying to set up kubernetes on your local machine but trying to use initialize it with kubeadmin init, returns the following error:

[init] Using Kubernetes version: v1.18.3
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR Swap]: running with swap on is not supported. Please disable swap
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

Solution

Switch the swap to off (Ubuntu command below) and try again.

sudo swapoff -a

Setting up worldPing with Grafana running in docker

You would like to test worldPing (https://worldping.raintank.io/worldping/) in your local environment for evaluation purposes.

  • Install Grafana with docker as described here (https://grafana.com/docs/grafana/latest/installation/docker/) and give it a name (ie grafana)
  • Login to the grafana container and install the worldPing plugin:
$ docker exec -it grafana /bin/bash
bash-5.0$ grafana-cli plugins install raintank-worldping-app
  • Exit from the container and stop and start it
bash-5.0$ exit
$ docker stop grafana
$ docker start grafana
  • Login to your grafana installation on the browser (localhost:3000) and go to the section for the plugins to find worldPing
  • To be able to enable it you will need an API key from Grafana Cloud, so create a free account (https://grafana.com/signup/starter/connect-account)
  • Create an API key (Security – API Keys – Add API Key)
  • Go back to Grafana web UI and add the API key so you can enable the worldPing. Add an endpoint to check and select the services to check (DNS, Ping, HTTP, HTTPS)
  • Leave it running for a few minutes and check the dashboards afterwards.
  • Remember to Disable if you want to go back to it again in the near future, or Destroy the endpoint if you do not need it anymore.

Docker Cloud moving one node from one account to another

Problem

You have used ‘Bring your own node’ to use a server with one account, but you want to change the account and move the node to the new one.

Solution

Use your old account to terminate the node or login to the server and use the following to stop the running dockercloud-agent:

sudo service dockercloud-agent stop

Go to the Docker Cloud web ui interface, and use the 'Bring your own node'. Copy the token that appears after the sudo -H sh -s on the popup window.

On the server update the token with the one from the new account that you just copied, by running the following:

sudo dockercloud-agent set Token=xxxxx_new_token_xxxx

And now restart the dockercloud-agent on the server:

sudo dockercloud-agent restart

You should now be able to see 'Node xxxx detected' on the Docker Cloud web ui after a couple of minutes.

Clearing unused (dangling) docker volumes

Problem

After you start using and building Docker images, there is a case that there is a lot of space used even after deleting images and containers (a few GB maybe).

Solution

To clean out the volumes that are no longer used (ie dangling) use the following:

sudo docker volume ls -qf dangling=true | xargs -r sudo docker volume rm

Using Elixir with Docker

In order to be able to use Elixir with the help of Docker, so that you can run different containers with different versions, and to have a shared code folder, you could follow the steps below:

  • Install docker in your system. Installation instructions for different systems are here
  • Download the elixir image from the Docker Hub:
    sudo docker pull trenpixster/elixir
  • List the images on your host:
    sudo ps docker images
  • Start a specific version of the elixir docker container (ie elixir 1.0.3):
    sudo docker run -t -i trenpixster/elixir:1.0.3 /bin/bash
  • Use a shared folder with code between the docker container and your host:
    sudo docker run -v /home/user/Prog:/Prog -t -i trenpixster/elixir:1.0.3 /bin/bash

    where the folders after the -v option are /home/user/Prog (host) and /Prog (docker)

  • Use a port forwarding:
    sudo docker run -p 8000 -v /home/user/Prog:/Prog -t -i trenpixster/elixir:1.0.3 /bin/bash

Docker error – error response from daemon: Cannot start container….is not within /var/lib/docker/aufs/mnt

Problem

You are trying to use an image from Docker in your Ubuntu 14.04 system, but you are getting a error like the following:

014/12/13 17:10:23 Error response from daemon: Cannot start container 4023610855c0551bdc44d0e602f20999c0527da3cfe010169707248887b3a1f0: /var/lib/docker/aufs/mnt/4023610855c0551bdc44d0e602f20999c0527da3cfe010169707248887b3a1f0 is not within /var/lib/docker/aufs/mnt/4023610855c0551bdc44d0e602f20999c0527da3cfe010169707248887b3a1f0

Solution

Your docker version is outdated (ie 1.0.1) so you would need to upgrade your docker installation.
There is a script for this (information from here):

After running the following you should be able to use your images as normal with: sudo docker run -t -i image/name bin/bash:

$ curl -s https://get.docker.io/ubuntu/ | sudo sh