I'm trying to build a centos7 docker image with telnet server. But I don't know how to enable telnet server in it, because systemctl doesn't work in docker.
Asked
Active
Viewed 1,588 times
3 Answers
1
You can directly use command xinetd
to start, not depends on systemd.
Next is the dockerfile and related files, you can build it by yourself.
Dockerfile:
FROM centos:7
RUN yum install -y xinetd && yum install -y telnet-server
COPY telnet /etc/xinetd.d/telnet
COPY docker-entrypoint.sh /
RUN chmod 777 docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
telnet:
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
docker-entrypoint.sh:
#!/bin/bash
xinetd -dontfork -stayalive

atline
- 28,355
- 16
- 77
- 113
0
You could give it a try with the docker-systemctl-replacement script.

Guido U. Draheim
- 3,038
- 1
- 20
- 19
-1
Did you try the steps given here ? The link has options with python example too.

Ganesh Chandrasekaran
- 1,578
- 12
- 17
-
No. That isn't what I want to do! – Traphix May 07 '19 at 01:58