I'm trying to start/run a docker container from a python3 script with the docker-py library. Here's the code.
c = docker.DockerClient()
ctr = c.containers.run('alexwoif/docker-grib2json',
command='grib2json --names --data --fp 2 --fs 103 --fv 10.0 --output /usr/local/{}.json /usr/local/{}'.format(grib_file, grib_file), detach=True)
The python script is on the host, not in the container, so when I run the script it cannot find the target grib_file. The error message is:
b'Cannot find input file: /usr/local/gfs_wind_f000.grib\n'
The python script is located in /var/www/mywebsite/api/data/grib and this is also where the *.grib file is located.
The command string is similar to the example given in the grib2json github project except I am using the --output to write the json to file.
grib2json --names --data --fp 2 --fs 103 --fv 10.0 gfs.t18z.pgrbf00.2p5deg.grib2
For clarification, the *.grib files that should be read and process to json are in the same directory as the python script.
I think the disconnect is the docker container is looking internally for the files instead of on the host file system.
How do I make that connection?
Many thanks for any suggestions you may have. Bryan