You don’t need to run systemd inside of the container in order to do this. Daemons run in containers should be invoked directly as an ENTRYPOINT
.
After installation with yum install -y telnet-server
, you can see a systemd service file indicating how the server is meant to be run at /usr/lib/systemd/system/telnet@.service
.
[root@baf4029d2be6 /]# cat "/usr/lib/systemd/system/telnet@.service"
[Unit]
Description=Telnet Server
After=local-fs.target
[Service]
ExecStart=-/usr/sbin/in.telnetd
StandardInput=socket
You could invoke /usr/sbin/in.telnetd
directly (although it looks like the dep on systemd is more hardcoded than I initially thought, relying on socket activation etc.).
There is also instructions for “Running a systemd based service” at https://hub.docker.com/_/centos/. Did you try them? I’m able to get a working telnet server running in systemd in a container fine by following the instructions there (including making the temporary bind mount dir as suggested by comments). The authentication fails when attempting a telnet
, but I can clearly see the process running, so it merely needs to be configured to accept connections properly.