Translate

Sunday, August 14, 2022

Server chronicles - Docker on ProLiant

At the base of the rebuilding of the services on the server, there is Docker.

Docker allows to run services in a dedicated environment.
Why ? Well, because different applications/programs can require different settings, like maybe the installation of specific languages or specific versions of them.
Instead to clutter the server with 3000 things, a docker image is totally self sufficient.

Docker installation

When installing the OS, at least the server edition, at a certain point the system asks to install extra packages, among them Docker.

I did choose that, but anyway I choose to re-install it again and actually some packages were missing, so if I ever re-install from scratch Ubuntu, I'll avoid the initial installation.

The goal is to install Docker and Docker compose on the server.

Let start with the usual update :

  • sudo apt update
  • sudo apt upgrade
Then add the certificates for the Docker repo
  • sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y

add the Docker repository to the system

  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  • echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

another round of update

  • sudo apt update
  • sudo apt upgrade

and finally 

  • sudo apt install docker-ce

Verify Docker is up and running

  • sudo systemctl status docker

Docker compose installation

At this time, having Docker up and running, is possible to install Docker compose.

Docker compose is an utility that allows to create Docker systems using a YML file.

To install Docker compose :

  • look at the release page of Docker compose to identify latest/current version to install
    At the time of this article writing is the 2.9.0
  • create directory : mkdir -p ~/.docker/cli-plugins
  • install version in the directory : curl -SL https://github.com/docker/compose/releases/download/v2.9.0/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
  • make it executable : chmod +x ~/.docker/cli-plugins/docker-compose
  • verify is installed :  docker compose version

Persistent storage

Storing data in the docker image is possible, however in case the image is stopped, all the stored data are lost !

Since Docker will be used to run services and these services uses data, there will be on the server some areas with the persistent data for all the services.

From the root filesystem a directory will hold all the persistent storage, in order to facilitate the backup.


Resources
















No comments:

Post a Comment