|
1 | | -# GTSAM Containers |
| 1 | +# GTSAM Docker Images |
2 | 2 |
|
3 | | -- container files to build images |
4 | | -- script to push images to a registry |
5 | | -- instructions to pull images and run containers |
| 3 | +The official Docker images for GTSAM are maintained in the [borglab/docker-images](https://github.com/borglab/docker-images) repository. |
6 | 4 |
|
7 | | -## Dependencies |
| 5 | +## Available Images |
8 | 6 |
|
9 | | -- a container engine such as [`Docker Engine`](https://docs.docker.com/engine/install/) |
| 7 | +The following images are available on Docker Hub, primarily under the `borglab` namespace: |
10 | 8 |
|
11 | | -## Pull from Docker Hub |
| 9 | +- **[borglab/gtsam](https://hub.docker.com/r/borglab/gtsam)**: |
| 10 | + A pre-compiled environment containing the latest `develop` branch of GTSAM. Useful for quick testing or as a base for downstream applications. |
| 11 | + - *Source:* [`docker-images/gtsam`](https://github.com/borglab/docker-images/tree/main/gtsam) |
12 | 12 |
|
13 | | -Various GTSAM image configurations are available at [`docker.io/borglab/gtsam`](https://hub.docker.com/r/borglab/gtsam). Determine which [tag](https://hub.docker.com/r/borglab/gtsam/tags) you want and pull the image. |
| 13 | +- **[borglab/gtsam-manylinux](https://hub.docker.com/r/borglab/gtsam-manylinux)**: |
| 14 | + An environment based on `manylinux2014` tailored for building Python wheels for GTSAM. |
| 15 | + - *Source:* [`docker-images/gtsam-manylinux`](https://github.com/borglab/docker-images/tree/main/gtsam-manylinux) |
14 | 16 |
|
15 | | -Example for pulling an image with GTSAM compiled with TBB and Python support on top of a base Ubuntu 22.04 image. |
| 17 | +- **[borglab/ubuntu-boost-tbb](https://hub.docker.com/r/borglab/ubuntu-boost-tbb)**: |
| 18 | + Base image (Ubuntu 24.04) with Boost and TBB libraries pre-installed. |
| 19 | + - *Source:* [`docker-images/ubuntu-boost-tbb`](https://github.com/borglab/docker-images/tree/main/ubuntu-boost-tbb) |
| 20 | + |
| 21 | +- **CI Images**: |
| 22 | + Various images used for Continuous Integration, covering different Ubuntu versions (22.04, 24.04) and compilers (Clang, GCC). |
| 23 | + - *Source:* [`docker-images/gtsam-ci`](https://github.com/borglab/docker-images/tree/main/gtsam-ci) |
| 24 | + |
| 25 | +## Usage |
| 26 | + |
| 27 | +### Running GTSAM |
| 28 | + |
| 29 | +To start an interactive shell in a container with GTSAM pre-installed: |
16 | 30 |
|
17 | 31 | ```bash |
18 | | -docker pull docker.io/borglab/gtsam:4.2.0-tbb-ON-python-ON_22.04 |
| 32 | +docker run -it borglab/gtsam:latest |
19 | 33 | ``` |
20 | 34 |
|
21 | | -[`docker.io/borglab/gtsam-vnc`](https://hub.docker.com/r/borglab/gtsam-vnc) is also provided as an image with GTSAM that will run a VNC server to connect to. |
| 35 | +### Using the Python Wrapper |
22 | 36 |
|
23 | | -## Using the images |
| 37 | +The `borglab/gtsam` image typically includes Python bindings. To use them: |
24 | 38 |
|
25 | | -### Just GTSAM |
| 39 | +1. Start the container: |
| 40 | + ```bash |
| 41 | + docker run -it borglab/gtsam:latest |
| 42 | + ``` |
| 43 | +2. Launch Python: |
| 44 | + ```bash |
| 45 | + python3 |
| 46 | + ``` |
| 47 | +3. Import GTSAM: |
| 48 | + ```python |
| 49 | + import gtsam |
| 50 | + print(gtsam.Pose3()) |
| 51 | + ``` |
26 | 52 |
|
27 | | -To start the image, execute |
| 53 | +## Building Images |
28 | 54 |
|
29 | | -```bash |
30 | | -docker run -it borglab/gtsam:4.2.0-tbb-ON-python-OFF_22.04 |
31 | | -``` |
| 55 | +To build these images locally or contribute changes, please refer to the **[borglab/docker-images](https://github.com/borglab/docker-images)** repository. It contains the Dockerfiles and build scripts for all the images listed above. |
32 | 56 |
|
33 | | -after you will find yourself in a bash shell. |
| 57 | +### Legacy Configuration |
34 | 58 |
|
35 | | -### GTSAM with Python wrapper |
36 | 59 |
|
37 | | -To use GTSAM via the python wrapper, similarly execute |
38 | 60 |
|
39 | | -```bash |
40 | | -docker run -it borglab/gtsam:4.2.0-tbb-ON-python-ON_22.04 |
41 | | -``` |
| 61 | +The following files in this directory are legacy artifacts and are **no longer actively maintained**: |
42 | 62 |
|
43 | | -and then launch `python3`: |
44 | 63 |
|
45 | | -```bash |
46 | | -python3 |
47 | | ->>> import gtsam |
48 | | ->>> gtsam.Pose2(1,2,3) |
49 | | -(1, 2, 3) |
50 | | -``` |
51 | 64 |
|
52 | | -### GTSAM with Python wrapper and VNC |
| 65 | +- **`Containerfile`**: Build instructions for a standalone GTSAM image (cloning from git and building from source). |
53 | 66 |
|
54 | | -First, start the image, which will run a VNC server on port 5900: |
| 67 | +- **`compose.yaml`**: A Docker Compose wrapper used for configurable builds (via `.env` variables like `GTSAM_WITH_TBB`, `GTSAM_BUILD_PYTHON`) and standardized image tagging. |
55 | 68 |
|
56 | | -```bash |
57 | | -docker run -p 5900:5900 borglab/gtsam-vnc:4.2.0-tbb-ON-python-ON_22.04 |
58 | | -``` |
| 69 | +- **`hub_push.sh`**: A utility script to iterate through configuration matrices and push multiple image variants to Docker Hub. |
59 | 70 |
|
60 | | -Then open a remote VNC X client, for example: |
61 | 71 |
|
62 | | -#### Linux |
63 | 72 |
|
64 | | -```bash |
65 | | -sudo apt-get install tigervnc-viewer |
66 | | -xtigervncviewer :5900 |
67 | | -``` |
| 73 | +For official builds and the most up-to-date configurations, please refer to the **[borglab/docker-images](https://github.com/borglab/docker-images)** repository. |
68 | 74 |
|
69 | | -#### Mac |
70 | 75 |
|
71 | | -The Finder's "Connect to Server..." with `vnc://127.0.0.1` does not work, for some reason. Using the free [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/), enter `0.0.0.0:5900` as the server. |
72 | 76 |
|
73 | | -## Build images locally |
| 77 | +> **TODO**: Consider migrating the configurable build and matrix-pushing functionality from these legacy files into the `docker-images` repository to support more flexible local builds. |
74 | 78 |
|
75 | | -### Build Dependencies |
76 | 79 |
|
77 | | -- a [Compose Spec](https://compose-spec.io/) implementation such as [docker-compose](https://docs.docker.com/compose/install/) |
78 | 80 |
|
79 | | -### `gtsam` image |
| 81 | +## VNC Support (`gtsam-vnc`) |
80 | 82 |
|
81 | | -#### `.env` file |
82 | 83 |
|
83 | | -- `GTSAM_GIT_TAG`: [git tag from the gtsam repo](https://github.com/borglab/gtsam/tags) |
84 | | -- `UBUNTU_TAG`: image tag provided by [ubuntu](https://hub.docker.com/_/ubuntu/tags) to base the image off of |
85 | | -- `GTSAM_WITH_TBB`: to build GTSAM with TBB, set to `ON` |
86 | | -- `GTSAM_BUILD_PYTHON`: to build python bindings, set to `ON` |
87 | | -- `CORES`: number of cores to compile with |
88 | 84 |
|
89 | | -#### Build `gtsam` image |
| 85 | +The **gtsam-vnc** image configuration is available locally in the [`gtsam-vnc`](./gtsam-vnc) subdirectory. This image extends the official `borglab/gtsam` image by adding a VNC server, allowing you to view GUI applications (like Matplotlib plots) running inside the container. |
90 | 86 |
|
91 | | -```bash |
92 | | -docker compose build |
93 | | -``` |
94 | 87 |
|
95 | | -### `gtsam-vnc` image |
96 | 88 |
|
97 | | -#### `gtsam-vnc/.env` file |
| 89 | +### Building and Running VNC Image |
98 | 90 |
|
99 | | -- `GTSAM_TAG`: image tag provided by [gtsam](https://hub.docker.com/r/borglab/gtsam/tags) |
100 | 91 |
|
101 | | -#### Build `gtsam-vnc` image |
102 | 92 |
|
103 | | -```bash |
104 | | -docker compose --file gtsam-vnc/compose.yaml build |
105 | | -``` |
| 93 | +1. **Navigate to the directory:** |
106 | 94 |
|
107 | | -## Push to Docker Hub |
| 95 | + ```bash |
108 | 96 |
|
109 | | -Make sure you are logged in via: `docker login docker.io`. |
| 97 | + cd gtsam-vnc |
110 | 98 |
|
111 | | -### `gtsam` images |
| 99 | + ``` |
112 | 100 |
|
113 | | -Specify the variables described in the `.env` file in the `hub_push.sh` script. |
114 | | -To push images to Docker Hub, run as follows: |
115 | 101 |
|
116 | | -```bash |
117 | | -./hub_push.sh |
118 | | -``` |
119 | 102 |
|
120 | | -### `gtsam-vnc` images |
| 103 | +2. **Build the image:** |
121 | 104 |
|
122 | | -Specify the variables described in the `gtsam-vnc/.env` file in the `gtsam-vnc/hub_push.sh` script. |
123 | | -To push images to Docker Hub, run as follows: |
| 105 | + You can build it using Docker Compose or directly with Docker. |
124 | 106 |
|
125 | | -```bash |
126 | | -./gtsam-vnc/hub_push.sh |
127 | | -``` |
| 107 | + ```bash |
| 108 | +
|
| 109 | + # Example using docker build |
| 110 | +
|
| 111 | + docker build -t gtsam-vnc . |
| 112 | +
|
| 113 | + ``` |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | +3. **Run with Port Forwarding:** |
| 118 | + |
| 119 | + Map port 5900 to access the VNC server. |
| 120 | + |
| 121 | + ```bash |
| 122 | +
|
| 123 | + docker run -p 5900:5900 gtsam-vnc |
| 124 | +
|
| 125 | + ``` |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +4. **Connect:** |
| 130 | + |
| 131 | + Use a VNC client to connect to `localhost:5900`. |
0 commit comments