Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: add usage explanations #4421

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 118 additions & 12 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# GRASS GIS docker

## GRASS GIS docker matrix
## GRASS GIS Docker installation and usage

[![Docker Pulls](https://img.shields.io/docker/pulls/osgeo/grass-gis.svg)](https://grass.osgeo.org/download/docker/)

Find out included version of GDAL, GEOS, PROJ, PDAL, Python and GRASS GIS using

```bash
grass --tmp-project XY --exec g.version -rge \
&& pdal --version \
&& python3 --version
```
The following instructions will guide you through setting up and using the
GRASS GIS via Docker or Podman.

## Requirements

* docker or podman
Have [Docker](https://www.docker.com/) or [podman](https://podman.io/) podman
installed.

## Overview

## Installation
For a list of GRASS GIS versions, see the
[docker tag list](https://hub.docker.com/r/osgeo/grass-gis/tags).

## General installation notes

To install a docker image, run (replace `<tag>` with the desired Docker tag from
the table above):
Expand All @@ -25,4 +24,111 @@ the table above):
docker pull osgeo/grass-gis:<tag>
```

## Provided images

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to have a list of images here? They are on the Docker hub and the website. This looks like user-facing doc, which is exactly what Docker hub and website are trying to cover, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I did not remember that it is also in the main README. I simply looked next to Docker.

Choose the image and running method that best suits your needs based on
the required features, available disk space, and whether you need GUI support.

### Alpine-based image

**Installation:**

```bash
docker pull osgeo/grass-gis:releasebranch_8_4-alpine
```

**Running:**

```bash
docker run -it --rm osgeo/grass-gis:releasebranch_8_4-alpine grass -c EPSG:4326 /tmp/grassproject
```

### Debian-based image

**Installation:**

```bash
docker pull osgeo/grass-gis:releasebranch_8_4-debian
```

**Running:**

```bash
docker run -it --rm osgeo/grass-gis:releasebranch_8_4-debian grass -c EPSG:4326 /tmp/grassproject
```

Comment on lines +54 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same for every image except for the tag. Too much stuff to read and maintain. Is there an example how other projects are addressing that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

### Ubuntu-based image

**Installation:**

```bash
docker pull osgeo/grass-gis:releasebranch_8_4-ubuntu
```

**Running:**

```bash
docker run -it --rm osgeo/grass-gis:releasebranch_8_4-ubuntu grass -c EPSG:4326 /tmp/grassproject
```

### Ubuntu-based image with GUI

**Installation:**

```bash
docker pull osgeo/grass-gis:releasebranch_8_4-ubuntu_wxgui
```

**Running:**

```bash
docker run -it --rm -e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
osgeo/grass-gis:releasebranch_8_4-ubuntu_wxgui grass
```

Comment on lines +84 to +88
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it clear that it won't work for windows (when not running through a WSL)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may add Windows usage instructions (I'd rely on others to suggest them).

## Additional usage tips

- To work with data on your host system, use the `-v` (volume) option
to mount a local directory:

```bash
docker run -it --rm -v "$(pwd):/data" osgeo/grass-gis:releasebranch_8_4-alpine grass
```

Comment on lines +95 to +97
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't work with Windows cmd.exe, might work with powershell (pwsh).

- To run a specific GRASS GIS command, append it to the end of the docker run command:

```bash
docker run --rm osgeo/grass-gis:releasebranch_8_4-alpine grass --exec r.info map=elevation
```

- For persistent sessions, consider creating a named container:

```bash
docker run -it --name my_grass_session osgeo/grass-gis:releasebranch_8_4-alpine grass
```

- To resume a named session:

```bash
docker start -ai my_grass_session
```

- Show GRASS GIS compilation metadata and dependencies

Find out which version of GDAL, GEOS, PROJ, PDAL, Python and GRASS GIS are
included in a specific image (example for Alpine):

```bash
docker run -it --rm osgeo/grass-gis:releasebranch_8_4-alpine \
grass --tmp-project XY --exec g.version -rge \
&& pdal --version \
&& python3 --version
```

## Resources

See also: <https://grass.osgeo.org/download/docker/>

For a detailed guide on GRASS GIS commands, check the
[GRASS GIS documentation](https://grass.osgeo.org/learn/).
Loading