Docker Registry on Ubuntu 20.04

Docker Registry could be useful in various scenarios, but the most common would be containers orchestration software such as Kubernetes, OpenShift/OKD or Nomad. In example environment you could have Gitlab CI pipeline configured to build Docker image and push it to your registry and then let orchestration software to deploy it to a cluster.

In order to install internal, private Docker Registry you need to install Docker package first.

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker

Then you need to grab certificate and start docker registry container:

sudo docker run -d --restart=always --name registry -v /home/user/certs:/certs -e REGISTRY_HTTP_ADDR=0.0.0.0:443 -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/certfile.pem -e REGISTRY_HTTP_TLS_KEY=/certs/keyfile.key -p 443:443 registry:2

This way we start a registry container which will always be up and running. We bind it on port 443 so need to have valid certificate and key for the domain. You can create A record for either public or private IP address. Former is easier, but the latter would be more secure. Both ways no need to setup insecure registries configuration as it will be offered via TLS connection.

After setting up, just build, tag and push container image to this registry.

Ubuntu 21 (impish) updates unavailable

I was trying to add some new packages and figured it out that my Ubuntu 21 is out of date. Unfortunately some time ago I unchecked all repositories in Software & Updates so my /etc/apt/sources.list was empty. But I managed to have it working properly adding this one:

deb http://old-releases.ubuntu.com/ubuntu impish main universe

Next

apt update

and I was more or less back on the track. How trivial was it just to be able to install default-jre package as I am trying to learn how to build custom deb packages.

Installing Metricbeat 7.17 agent on Ubuntu

Once you have installed Elasticsearch and Kibana servers you need to grab some data. First choice could be beats modules, either Metricbeat or Packetbeat. There is also Filebeat. Altough installation instructions are available at https://www.elastic.co/guide/en/beats/metricbeat/7.17/metricbeat-installation-configuration.html I found it useful to describe it separately as this page might just disappear out of a sudden.

curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.17.5-amd64.deb
sudo dpkg -i metricbeat-7.17.5-amd64.deb

After installation you need to change the configuration file at:

/etc/metricbeat/metricbeat.yml

Change Kibana and Elasticsearch output addresses. Then start the agent:

sudo service metricbeat start

In case this is the first time you are installing the agent against this particular Elasticsearch server you need to load visualizations and dashboard definitions:

metricbeat setup -e

Now you’re done and should be able to see you newly added host on Observability:Metrics:Inventory page. Remember to press Auto-refresh button.