If you've problem in running the GUI Applications in the Container try the following methods:
Make sure that output of env | grep DISPLAY should contain 1 line and should look like this: DISPLAY=:1. If not then, manually feed the DISPLAY value in the run command. For example sudo docker run -d -it --rm -v ~/Docker/Shared-Volumes/ariitk-Container:/home/Shared-Volume/ -v /tmp/.X11-unix/:/tmp/.X11-unix --net host --env="DISPLAY=:1" --name ariitk <image_name/image_id>
If error = libGL error: MESA-LOADER: failed to retrieve device information. Add this parameter this in docker run : -e LIBGL_ALWAYS_SOFTWARE=1 and install the required libraries.
Note: We've provided --rm argument, so do all the work in the shared directory. Because all the data outside shared directory would be deleted as soon as the container is stopped. And in order to save any changes in the docker container, use docker commit to create a new version for the changes
To test the Successful Setup of Docker Container, run the following commands in different Terminals (in order)
roscore
cd ~/PX4-Autopilot/ && make px4_sitl_default gazebo_iris
roslaunch mavros px4.launch fcu_url:=udp://:14540@localhost:14557
Note: If the mavros command fails, free some resources (CPU & RAM) on your PC & Try again in 1 minute. And repeat this setup until it stops crashing.
You should see a Drone in the Ground.
To Test MAVROS and MAVPROXY. You can ARM the drone.
List the ROS Topics and Services with the following commands.
rostopic list
rosservice list
Save the Initial Changes
To save the Initial Changes make an image of the container
docker commit ariitk ariitk/px4
Export Docker Image
To export a docker Image, type the following command
docker save -o <filename>.tar ariitk/px4
Using Docker Image
Import Docker Image
To import a docker image, type the following command
docker load -i <filename>.tar
You can then tag the import image with the following command
docker tag <image_id> my_custom_image:latest
You can find the image_id with the following command
docker image list
Make a Shared Directory between Host & Docker Container
If you've problem in running the GUI Applications in the Container try the following methods:
Make sure that output of env | grep DISPLAY should contain 1 line and should look like this: DISPLAY=:1. If not then, manually feed the DISPLAY value in the run command. For example sudo docker run -d -it --rm -v ~/Docker/Shared-Volumes/ariitk-Container:/home/Shared-Volume/ -v /tmp/.X11-unix/:/tmp/.X11-unix --net host --env="DISPLAY=:1" --name ariitk <image_name/image_id>
If error = libGL error: MESA-LOADER: failed to retrieve device information. Add this parameter this in docker run : -e LIBGL_ALWAYS_SOFTWARE=1 and install the required libraries.
Note: We've provided --rm argument, so do all the work in the shared directory. Because all the data outside shared directory would be deleted as soon as the container is stopped. And in order to save any changes in the docker container, use docker commit to create a new version for the changes