Full steps to deploy ROS2 docker image in ubuntu18.04 environment

  • sudo docker run -d --privileged=true --runtime=nvidia 
    --gpus=all --net=host --ipc=host --restart=always -v 
    /dev:/dev -v /data/autocar:/home/mogo/data --name 
    map_test mogohub.tencentcloudcr.com/autocar-ros2/df:mystart_RoboTaxi_df_1.0.0.30_ros2_202
    30524_dev

        This is a command to run a machine learning application in Docker, which runs the application as a Docker image, accelerated with NVIDIA GPUs.

        Specifically, the meanings of the parameters of this command are as follows:

  • sudo: Run the command with administrator privileges.
  • docker run: A command to run a Docker container.
  • -d: Let the container run in the background.
  • --privileged=true: Run the container in privileged mode, with access to all devices of the host.
  • --runtime=nvidia: Specifies that the container runs on an NVIDIA GPU.
  • --gpus=all: Allocate all available GPUs to the container.
  • --net=host: Using the host network mode, the container shares the network stack with the host.
  • --ipc=host: Using the host IPC (Inter-Process Communication) namespace, the container shares IPC with the host.
  • --restart=always: Automatically restart the container after it stops.
  • -v /dev:/dev: Mount the host's  /dev directory into the container's  /dev directory so that the container can access the host's devices.
  • -v /data/autocar:/home/mogo/data/data/autocar Mount the host's directory into the container's  /home/mogo/data directory so that the container can access the host's data.
  • --name map_test: Give the container a name of  map_test.
  • mogohub.tencentcloudcr.com/autocar-ros2/df:mystart_RoboTaxi_df_1.0.0.30_ros2_20230524_dev: Specifies the Docker image name and version number to run.

        To sum up, the function of this command is to run a Docker container in privileged mode, use NVIDIA GPU for acceleration, and let the container share the network and IPC namespace with the host, as well as the host device and data, in order to run the machine learning application contained in the image program.

  • sudo docker pull mogohub.tencentcloudcr.com/autocar
    /system-redis:system-redis_CDXTJG_Default_1.0.0.2_6_
    log_20230329_dev

 The function of this command is to pull a Docker image named mogohub.tencentcloudcr.com/autocar/system-redisand version number        from the specified Docker image repository  . system-redis_CDXTJG_Default_1.0.0.2_6_log_20230329_devAfter an image is pulled,  docker run commands can be used to start applications or services contained in that image.

  • mkdir -p /data/autocar/log/redis

  • sudo docker run -d --privileged --network host -v /data/autocar/log/redis:/var/log/redis:rw --restart=always --name redis redis镜像名

Configuration modification:

1. Change the ip in /opt/ros/humble/etc/redis_conn_conf.json autocar image to the virtual machine ip. Pit point: Remember to change the ip in /run.sh synchronously, otherwise the configuration will be restored after restarting the container. Then restart the autocar image

2. Execute in the redis image: Execute this command (vim and other editing software are not installed by default in docker) echo -e '#!/bin/bash\nredis-server /etc/redis/redis.conf' > /run.sh( The default is on the real car, there is a real car ip judgment) remove the judgment line. Restart the redis mirror

Guess you like

Origin blog.csdn.net/John_ToStr/article/details/130877293