What are we doing here?

This blog includes a series of videos and references to help new users or enthusiasts better understand how to use open source and free technology tools. The quick links includes more information for accessing many of the tools covered along with other references to learn more for taking advantage of these tools.

Click HERE to see the full list of topics covered!

Revisting Alpine Linux - rc-update

I had a quick look back at my Alpine VM and installed Docker on it just to check how difficult / easy it would be. It is very easy. 

In Alpine as root run:

apk add docker docker-cli docker-compose

Alpine will get the necessary packages and install Docker. Alternatively, running apk search docker will also bring up a list of different packages in case you need a specific version of any of those packages. 

In Alpine, I had forgotten how to enable the Docker daemon - the services in POSIX (Unix/BSD/Linux) that run all range of functions in the back end - and Genesys Engage (what came up in Google) had a good article here. What I found interesting was the output of the rc-update command. 

The output instantly shows all the services set to start and whether they are set to start on boot or by default. Running rc-status also can instantly display all the running services. 

To start the docker daemon as root run: 

service docker start

To ensure it starts on boot run:

rc-update add docker boot

And that's it. Pretty straightforward to get started with and being so light running an Alpine VM with docker might be a good way to have something that is light on system resources without needing to run the containers directly on your Linux, Windows, or MacOS system. Containers are pretty secure, but don't offer 100% isolation to the extent of a VM. Setting up a light VM on something like Alpine which you can backup and blow away should there be a problem might come in handy for certain deployments. 

A side note, to get something similar to rc-update output on Ubuntu and Fedora there is the 'service' or 'systemctl' commands. 

service --status-all 

The [+] or [-] represents whether the service is running. OR:

systemctl list-units --type=service

The latter is likely the more relevant as its calling from the systemd which both Ubuntu and Fedora use. Systemd is the way many modern Linux operating systems manage processes. Alpine rc-update uses OpenRC as it's init system hence the difference. 

This gets complex quickly, but to boil it down Linux is open source software so many things, including the way services are called and managed. This is why each Linux can have it's own set of design decisions and quirks. The modularity of Linux is also why it is so popular by leading companies, academics, and even NASA.

For more detailed reading here are some relevant links. I just found it interesting the functionality of the rc-update commands and the ease with which Docker can be installed on Alpine.

https://en.wikipedia.org/wiki/Systemd

Fedora services and daemons

Alpine Linux Init System

*Update: Reinstalling this as another test showed that the docker packages are not in the main, but rather the community repositories. These can be added to Alpine by editing the /etc/apk/respositories file and then running apk update. More info on the repositories can be found here.

No comments:

Post a Comment