If you are looking for a better solution go and checkout osrf's rocker repository
This "package" allows you to create docker images where you can run graphical programs like Gazebo without effort. Docker image is based on official ROS docker images, but it can easily be changed to something else.
Here is the list that i didn't done yet™:
- Cross platform container support for network and UI operations
- Support for NVidia Graphics Cards
There is no need to install this "package". But if you wish you can do something like:
- Create some local directory like
~/.dockerize
- Clone this repository in
~/.dockerize
- Create symlink to
~./.dockerize/dockerize.sh
/usr/local/bin/dockerize
- Call
dockerize
anywhere
$ mkdir -p ~/.dockerize
$ cd ~/.dockerize
$ git clone https://github.com/incebellipipo/dockerize
$ sudo ln -s ~/.dockerize/dockerize.sh /usr/local/bin/dockerize
Build images
Building images is pretty straight forward, only consumed variable here is ROS_VERSION
environment variable. It could be set to versions of ROS which are published in docker hub.
$ export ROS_VERSION=kinetic
$ ./dockerize.sh build
Run images
$ ./dockerize.sh run
In order to run graphics applications like gazebo, you need to be in video
group. The user after you logged in to docker container is won't be in all groups where your local user belongs even though all user variables will be shared. As a quick work around you need to be logged in once again by using su
command
# Inside Docker
$ su - ${USER}
Password:
I personally recommend tmux after that.
Attaching running container
$ ./dockerize.sh attach
Stopping running container
$ ./dockerize.sh stop
Cleaning detached containers
$ ./dockerize.sh clean
Customize just like create any other Dockerfile.