简体   繁体   中英

Install localectl in Debian based docker container

The command line utility localectl is present on Debian based systems. However, it is not present in the dockerized version of the distro

$ localectl
bash: loaclectl: command not found

Steps to reproduce:

  1. Install docker and docker-compose on your system
  2. docker pull debian
  3. docker run -it debian bash
  4. localectl

I wanted to know if there was a way to install it inside the docker container of debian or ubuntu image.

You'll regularly find that some packages aren't a part of the base Docker images - this is because the maintainers only put in what is absolutely necessary so that they run as small as possible.

I discovered that localectl is a part of the systemd package - which makes sense, as systemd and initd aren't really necessary in Docker - which is meant to only run a single process. While the documentation I linked goes to Ubuntu, the following will install the binaries needed:

apt-get update && apt-get install -y systemd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM