Skip to content

Commit e6d8c7c

Browse files
smartin015mergify[bot]
authored andcommitted
Replace start-docker.sh with docker-compose.yml (#422)
(cherry picked from commit 352061d) # Conflicts: # doc/how_to_guides/how_to_setup_docker_containers_in_ubuntu.rst
1 parent 5122b21 commit e6d8c7c

File tree

3 files changed

+70
-80
lines changed

3 files changed

+70
-80
lines changed

_scripts/docker-compose.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Example command:
2+
#
3+
# DOCKER_IMAGE=humble-source docker-compose run gpu
4+
5+
x-base-cpu: &base-cpu
6+
privileged: true
7+
network_mode: host
8+
environment:
9+
QT_X11_NO_MITSHM: 1
10+
volumes:
11+
- /tmp/.X11-unix:/tmp/.X11-unix
12+
- ~/.Xauthority:/root/.Xauthority
13+
command: /bin/bash
14+
15+
x-base-gpu: &base-gpu
16+
<<: *base-cpu
17+
deploy:
18+
resources:
19+
reservations:
20+
devices:
21+
- driver: nvidia
22+
count: 1
23+
capabilities: [gpu]
24+
environment:
25+
NVIDIA_VISIBLE_DEVICES: all
26+
NVIDIA_DRIVER_CAPABILITIES: all
27+
28+
services:
29+
cpu:
30+
<<: *base-cpu
31+
image: moveit/moveit2:$DOCKER_IMAGE
32+
volumes:
33+
- moveit2-data:/root
34+
environment:
35+
DISPLAY: $DISPLAY
36+
gpu:
37+
<<: *base-gpu
38+
image: moveit/moveit2:$DOCKER_IMAGE
39+
volumes:
40+
- moveit2-data:/root
41+
environment:
42+
DISPLAY: $DISPLAY
43+
44+
volumes:
45+
moveit2-data:

_scripts/start-docker.sh

Lines changed: 0 additions & 72 deletions
This file was deleted.

doc/how_to_guides/how_to_setup_docker_containers_in_ubuntu.rst

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
11
How to Set Up MoveIt 2 Docker Containers in Ubuntu
22
===================================================
33
This guide will provide a walkthrough on how to get a Docker container with MoveIt 2 dependencies set up quickly.
4-
It includes a script that will get you up and running in MoveIt quickly!
4+
It includes a docker-compose config file that will get you up and running in MoveIt quickly!
55
This guide is intended for people who would like to have a separate environment for working with MoveIt up and running quickly \
66
without having to do much configuring. In this guide, we will be setting up a ROS2 Humble environment.
77

88
Learning Objectives
99
-------------------
1010

11-
- How to setup a Docker environment using the provided script
11+
- How to setup a Docker environment using the provided docker compose config
1212

1313
Requirements
1414
------------
1515

1616
- Ubuntu 20.04 or 22.04
1717
- `Docker Installation for Ubuntu <https://docs.docker.com/engine/install/ubuntu/>`_
1818
- `Nvidia drivers for Docker <https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit>`_
19+
- `docker compose (if not already installed via Docker Desktop) <https://docs.docker.com/compose/install/>`_
1920

2021
Steps
2122
-----
22-
1. Install Docker (a link is available in the Requirements section) and be sure to follow the `Linux Post Install <https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user>`_ instructions. If you do not complete these additional steps you will need to preface all ``docker`` commands with ``sudo``.
23+
1. Install Docker and docker compose (links are available in the Requirements section) and be sure to follow the `Linux Post Install <https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user>`_ instructions. If you do not complete these additional steps you will need to preface all ``docker`` commands with ``sudo``.
2324

24-
2. Open a terminal session, download the Docker script, and make it executable.
25+
2. Open a terminal session, download the config, and make it executable.
2526

2627
.. code-block:: bash
2728
28-
wget https://raw.githubusercontent.com/abake48/moveit2_tutorials/how-to-docker-ubuntu/_scripts/start-docker.sh -O ~/.local/bin/start-docker.sh
29-
chmod +x ~/.local/bin/start-docker.sh
29+
wget https://raw.githubusercontent.com/ros-planning/moveit2_tutorials/how-to-docker-ubuntu/_scripts/docker-compose.yml
3030
31-
3. Run the script.
31+
3. Launch the container (you may need to hyphenate ``docker-compose`` if using compose V1)
3232

33+
<<<<<<< HEAD
3334
There are 3 parameters for the script:
3435
- ``name_of_the_container`` : this is the name you wish to give the created container. For this guide, we will be naming the container ``moveit2-humble``.
3536
- ``name_of_the_image`` : if you are creating a fresh Docker container, provide the name of the Docker image here. For this guide, we will be using the image ``moveit/moveit2:humble-source``. Further explanation of this parameter is provided in the ``Further Reading`` section.
3637
- ``using_gpu`` : if ``true``, the Docker will be run using Nvidia GPU drivers. By default, this value is true.
38+
=======
39+
.. code-block:: bash
40+
>>>>>>> 352061d (Replace start-docker.sh with docker-compose.yml (#422))
3741

38-
To run the script and use Nvidia GPU drivers
42+
DOCKER_IMAGE=rolling-source docker compose run gpu
3943

44+
<<<<<<< HEAD
4045
.. code-block:: bash
4146
4247
start-docker.sh moveit2-humble moveit/moveit2:humble-source
@@ -63,6 +68,13 @@ Steps
6368
.. code-block:: bash
6469
6570
start-docker.sh moveit2-humble
71+
=======
72+
You can replace ``rolling-source`` with other tagged images, e.g. ``humble-source``. Similarly, you can replace ``gpu`` with ``cpu`` if you do not wish to run using Nvidia GPU drivers.
73+
74+
4. You should now be inside of your Docker container, in the workspace directory. You should now be able to start working with MoveIt!
75+
76+
Whenever you wish to reenter your container, run the same command as in #3.
77+
>>>>>>> 352061d (Replace start-docker.sh with docker-compose.yml (#422))
6678

6779
Further Reading
6880
---------------
@@ -73,5 +85,10 @@ Further Reading
7385
- You can find a list of tagged images for the MoveIt 2 Docker container `here <https://hub.docker.com/r/moveit/moveit2/tags>`_.
7486
The tagged images coincide with ROS2 version releases. The ``release`` version of the container provides an environment in which MoveIt 2 is installed via the binaries.
7587
The ``source`` version of the Docker image will build MoveIt 2 from source.
88+
<<<<<<< HEAD
7689
You can use any of the images in that link by substituting the second parameter in the script, ``name_of_the_image``, with moveit/moveit2:<tag_name>, where ``<tag_name>`` is from the above link.
7790
For example, this guide instructs you to use the image with the tag ``humble-source``.
91+
=======
92+
You can use any of the images in that link by substituting the DOCKER_IMAGE environment variable with ``moveit/moveit2:<tag_name>``, where ``<tag_name>`` is from the above link.
93+
For example, this guide instructs you to use the image with the tag ``rolling-source``.
94+
>>>>>>> 352061d (Replace start-docker.sh with docker-compose.yml (#422))

0 commit comments

Comments
 (0)