Industrial Internet Application Development
上QQ阅读APP看书,第一时间看更新

Running a simulator application on an RPi

To run a simulator application, follow the sequence of actions as described here:

  1. Open an SSH connection.
  2. Navigate to /home/pi/sensor.
  3. Build an image and run a Docker container:
# Build an image from a Dockerfile
docker build -t modbus-sensor .
#
# Run container in foreground
docker run -p 1502:1502 --privileged -it --rm --name modbus-sensor-container modbus-sensor
#
# Run container in background
# docker run -p 1502:1502 --privileged -d --rm --name modbus-sensor-container modbus-sensor
#
# Fetch the logs of a container
# docker logs -f modbus-sensor-container
#
# Stop running container
# docker stop modbus-sensor-container
Console output when a simulator app is running