I am using the mundialis/grass-py3-pdal:8.2.0-alpine docker image to run GRASS. I run the following from the bash command line (inside the container):

/usr/local/grass/bin/v.in.ogr input=/path/to/nonexistent/folder/and/file.shp output=/another/nonexistent/path

... and I get back no output. The script just runs and finishes. No complaint. Nothing.

So I try it in verbose mode, with an existing output folder:

/usr/local/grass/bin/v.in.ogr --verbose input=/path/to/nonexistent/folder/and/file.shp output=/output

Still no complaint. Needless to say, there's also nothing in the output folder.

What's going on here? Is there a way I can get the script to give me more information? As I've never used this script, I'm sort of hoping to have some google-able error messages if possible.


EDIT #1: I verified that when I do ls /usr/local/grass/bin/v.in.ogr from inside the container, I get a listing of the script, which is shown in a nice, executable green font. So the script seems to be running. It's just being very, very quiet when things go wrong.


EDIT #2: I also verified with a touch that I have the rights to write to the output folder. So it's not that.


EDIT #3: I simplified the situation above somewhat to make the question easier to answer. The full command for running the script with a real file is docker-compose run --rm grass-service /usr/local/grass/bin/v.in.ogr --verbose input=/input/kx-amtrak-stations-SHP/amtrak-stations.shp output=/output/grass_map. This is also failing silently, though I get a status of 0 rather than a status of 1. The output folder is set to rw in my docker-compose.yml file, which looks like this:

version: '3'
    image: mundialis/grass-py3-pdal:8.2.0-alpine
      - ./output:/output:rw # This will be the persistent store
      - ./src:/src:rw # Contains code to run analysis
      - ./input:/input # Contains some .tif images to import
      - STAGE=dev
      - GISDBASE=/data/grassdata
      - LOCATION=2193
      - MAPSET=project
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - ADDITIONAL_PATH=/usr/local/grass/bin
    network_mode: host
    stdin_open: true
    tty: true

... and the Dockerfile looks like this:

FROM mundialis/grass-py3-pdal:8.2.0-alpine
RUN export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/grass/bin
RUN chmod +x /src/fulltask.sh
RUN chmod +w /output
  • Are you sure you're mounting your data paths correctly? The Docker container won't see paths on your host unless you allow it to do so. I'd try do something like ogrinfo -so /path/to.shp to check the data from inside the container. Oct 27, 2022 at 21:24
  • 1
    @alphabetasoup thanks for your comment. In my case, I know that the path is wrong. I'm thinking about opening a pull request to change the behavior so that -- at least in verbose mode -- the script complains loudly when the path isn't valid. Failing silently is not normal behavior Oct 28, 2022 at 8:00
  • It may fail silently with a non-zero status, which is still some form of information Oct 28, 2022 at 9:26
  • Oh yes, that's a great point Oct 28, 2022 at 12:51
  • Well, it appears that I only get a status code of 1, which is the generic status code for failure. So that's not terribly helpful. I would expect more output with the --verbose tag applied Oct 31, 2022 at 17:59

1 Answer 1


Before you can import a file using v.in.ogr you first have to create a GRASS environment: a database, location, and mapset. I use this same Docker container (in conjunction with some workflow software) and I precede the import statement with grass -c {file} -e {grass-database}:

GRASSDATA=/output/grassdata && \
MAP=amtrak-stations && \
mkdir -p $GRASSDATA && \
(grass -c /input/kx-amtrak-stations-SHP/amtrak-stations.shp -e $GRASSDATA && \
grass $GRASSDATA/$MAPSET/ --exec v.in.ogr --verbose --overwrite input=/input/kx-amtrak-stations-SHP/amtrak-stations.shp output=$MAP snap=0.0001) 2>&1 | tee /output/logfile

The first grass command creates the environment necessary to run other GRASS commands, which is necessary to establish a region, projection, etc. In this case it's created on the basis of the input that is imported in the second grass command, which is run using --exec so that it is a standalone shell command that does not need to be run in an interactive GRASS session.

Lastly it's wrapped in brackets and stdout/stderr are piped to tee to be written in a log file. This should allow you to both see any output on the terminal, but also have it written to a file; it may be that Docker is swallowing your stderr which is why you can't see any error output.

GRASS's idioms are tricky, I recommend doing some introductory GRASS tutorials but noting that with a Docker container this idiom of using --exec is very useful.

Note especially that the output of v.in.ogr is not a path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.