0

Docker noob here.. I want to dockerize my project. There is gps module in it. I can use python gpsd library with autousb option true. It automatically detects the usb port if it is connected. However I want to dockerize this option but could not found any solution. In ubuntu I can set up gpsd options with systemd services but there is no systemd in docker container. I do not want to set the usb port statically.

My ubuntu local gpsd settings

/etc/default/gpsd

# Start the gpsd daemon automatically at boot time
START_DAEMON="true"

# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES=""

# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="true"

# Other options you want to pass to gpsd
GPSD_OPTIONS="-F /var/run/gpsd.sock"

/lib/systemd/system/gpsd.service

[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
# Needed with chrony SOCK refclock
After=chronyd.service

[Service]
Type=forking
EnvironmentFile=-/etc/default/gpsd
ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $DEVICES

[Install]
WantedBy=multi-user.target
Also=gpsd.socket

/lib/systemd/system/gpsd.socket

[Unit]
Description=GPS (Global Positioning System) Daemon Sockets

[Socket]
ListenStream=/var/run/gpsd.sock
ListenStream=[::1]:2947
# ListenStream=127.0.0.1:2947
# To allow gpsd remote access, start gpsd with the -G option and
# uncomment the next two lines:
# ListenStream=[::1]:2947
ListenStream=0.0.0.0:2947
SocketMode=0600

[Install]
WantedBy=sockets.target
nogabemist
  • 402
  • 5
  • 29

0 Answers0