Docker Community Forums

Share and learn in the Docker community.

Container command app calling `localectl list-keymaps` and `timedatectl list-timezones` (systemd functions?) return empty

I created a dockerfile that runs the application manjaro-arm-installer.
This app is basically an installation/setup script calling a dialog with menu items to choose from.

One of those menu lists are generated by using the command lolalectl list-keymaps and another timedatectl list-timezones.
I believe both commands rely on systemd somehow.

They fail to create these lists when running the docker container like this

docker run --privileged -it dockerfile

or

docker run --runtime=sysbox-runc -it dockerfile

What to do?

docker run expects an image name as one of its parameters, not the name of a Dockerfile.

(Also, there’s very little context in your question to be able to help you.)

The context is not that complicated:

$ docker run --privileged -it dockerfile bash
[root@181f62b3c2c5 /]# localectl list-keymaps
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[folaht@pjehrsohmehj manjaro-arm-installer]$ docker run --privileged -it safenetwork-community/manjaro-arm-installer bash
[root@24bf5a1f1142 /]# localectl list-keymaps
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

So what’s the point? I doubt that any official base image commes with systemd enabled. Some people seem to have managed to hacked it together in their own images.

I am quite sure a short google search will reveal enough examples that show thru which hoops to jump to hack it together. Init processes like systemd are something you can expect from os virtualization (lxd containers?), though docker provides application virtualisation, which does not cover init processes like systemd.

What is the point of asking about a Docker issue on Docker community forum?

Well, when someone has an issue related to docker, I would assume that the best place to look for
issues related to docker is a docker forum, especially a docker community forum.
And if such docker issue is not on a docker community forum, I would assume that asking a docker related issue is best asked on a docker community forum.

One could also of course do a websearch, but most likely that would lead to a docker forum, where such questions are asked. And if then you would not find answers specific to yours, or find answers that do not help, like for example using --privileged or --runtime=sysbox-runc, then I would assume, that the next best thing to do, is to ask such question on a docker related forum.

Because maybe, someone has managed to hack it together, hasn’t mentioned this, but does visit this forum.

And even if not, it’s unlikely that there is a better place to ask.

That’s the point.

Sorry, If I was offending. I was just curious why a form post, instead of a google search, was done first.

In the last 8 years the docker engine exists, you are surely neither the first, nor last one to experience that systemd is not present in most images… Or if you build your own image, works out of the box. I would be suspicous as of why it is not working and do research to understand why.

In case you haven’t found this blog post yet. It describes on what needs to be done to make it work when building an image. Note: I don’t share the authors view that Docker would be “OS-level virtualization”, as docker containers, unlike LXD containers, realy doesn’t provide a full os.

Yeah, I’ve tried that as well. That doesn’t work.

Now this has given me an idea as I don’t blame you for the issue I’m having.
Gotta hope the ArchBang community still exists.
I’ll let you know if the new plan works.

1 Like

With a bit of help from the systemd-hating Artix Linux community:

timedatectl list-timezones

find /usr/share/zoneinfo/{Africa,America,Antarctica,Asia,Arctic,Atlantic,Australia,Europe,Indian,Pacific,UTC} -type f | cut -d '/' -f5-

localectl list-keymaps

find /usr/share/kbd/keymaps -type f -name *.gz -printf '%f\n' | cut -f 1 -d '.' | sort