This sample show how to execute a python script, which uses the xarray library within a simple docker container.
- Docker install with version 20.0 or above
- Install git on your computer
- Clone repository: $
git clone https://github.com/marcoberger/docker-xarray.git
Steps to start the container and execute script:
- start docker deamon or start Docker desktop application
- run commands:
cd ${PROJECT_ROOT_FOLDER}
docker-compose upCheck the console output for hello123, which is echoed by the python script.
- geodata/test.txt: The geo-data file to be read from a docker volume. The folder geodata/ is mounted as volume /mygeodata in docker image. See docker-compose.yml on line 6.
- src/script.py: The python script that is run in the container. See ENTRYPOINT on line 12 in Dockerfile
- requirements.txt: Requirements to be installed in the docker image. See lines 5-8 in Dockerfile
- Dockerfile: Describes how the docker image is built. Only happens once - not for each execution of the container.
- docker-compose.yml: Comfort docker tool to start the container and mount the volume.