/etc/ser2net.yml
Docker 컨테이너의 파일을 편집합니다.
ser2net 파일에 다음 항목을 추가했습니다.
connection: &con40000 accepter: tcp,40000 enable: on options: banner: *banner kickolduser: true telnet-brk-on-sync: true connector: serialdev, /dev/ttyUSB0, 115200n81,local nobreak
Docker 컨테이너를 다시 시작합니다.
docker stop my_container docker start my_container
컨테이너로 돌아가기
docker exec -it my_container bash
하지만다시 시작하지 못했습니다.
ser2net
:$ systemctl restart ser2net System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
전체 ser2net.yml
파일 입니다
%YAML 1.1
---
# This is a ser2net configuration file, tailored to be rather
# simple.
#
# Find detailed documentation in ser2net.yaml(5)
# A fully featured configuration file is in
# /usr/share/doc/ser2net/examples/ser2net.yaml.gz
#
# If you find your configuration more useful than this very simple
# one, please submit it as a bugreport
define: &banner \r\nser2net port \p device \d [\B] (Debian GNU/Linux)\r\n\r\n
connection: &con0096
accepter: tcp,2000
enable: on
options:
banner: *banner
kickolduser: true
telnet-brk-on-sync: true
connector: serialdev,
/dev/ttyS0,
9600n81,local
connection: &con1096
accepter: tcp,2001
enable: on
options:
banner: *banner
kickolduser: true
telnet-brk-on-sync: true
connector: serialdev,
/dev/ttyS1,
9600n81,local
connection: &con0192
accepter: tcp,3000
enable: on
options:
banner: *banner
kickolduser: true
telnet-brk-on-sync: true
connector: serialdev,
/dev/ttyS0,
19200n81,local
connection: &con1192
accepter: tcp,3001
enable: on
options:
banner: *banner
kickolduser: true
telnet-brk-on-sync: true
connector: serialdev,
/dev/ttyS1,
19200n81,local
connection: &con40000
accepter: tcp,40000
enable: on
options:
banner: *banner
kickolduser: true
telnet-brk-on-sync: true
connector: serialdev,
/dev/ttyUSB0,
115200n81,local nobreak
답변1
좋아요, 지적해 주신 @realpclaudio에게 감사드립니다. systemd를 구현하지 않습니다.
다음 두 가지 솔루션이 작동합니다.
$ docker exec -it hacpy_container pkill ser2net
$ docker exec -it hacpy_container ser2net -c /path/to/ser2net.yml
Unable to start mdns: Out of memory #<- this still restarted ser2net
그리고
$ service ser2net restart
Unable to start mdns: Out of memory #<- this still restarted ser2net
처음에는 이 질문에 대해 조금 혼란스러웠습니다.mdns를 시작할 수 없습니다: 메모리가 부족합니다.ser2net
하지만 포트 매핑에는 문제가 발생 하지 않았습니다 .