I'm new to docker so I'm sure what I am missing is as simple as a few words but I can't figure it out despite googling for a couple of hours.
python_code_to_run.py: Just loads a dataset and saves it...
import pandas as pd
import numpy as np
import os
import h2o
from h2o.estimators.gbm import H2OGradientBoostingEstimator
airlines= h2o.import_file("https://s3.amazonaws.com/h2o-public-test-
data/smalldata/airlines/allyears2k_headers.zip")
airlines_data = pd.DataFrame(airlines)
airlines_data.to_csv('airlines_dataset_dled.csv', index=False )
DockerFile: This runs when I use the -build command just fine...
From python:3.7-slim-buster
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install unzip build-essential libaio-dev
RUN python3 --version
RUN pip3 --version
RUN mkdir -p /src
COPY . /src
COPY /app/python_code_to_run.py /src
RUN chmod +x src/run_py_file.sh
RUN chmod +x src/python_code_to_run.py
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
CMD [ "/bin/sh", "docker_test.sh" ]
#ENTRYPOINT [ "bash" , "run_py_file.sh" ] # doesn't work either
** run_py_file.sh**
python /app/python_code_to_run.py
I have a folder:
- LearningDocker
DockerFile
script_to_trigger_code.sh
- app
- python_code_to_run.py
I can build the docker image just fine by running:
docker build -t my_attempt_to_learn_docker .
I will then take the ID# that it gives me and run:
docker run -v /Users/myname/Documents/docker_folder f28384723
I keep getting the error
**/bash: run_py_file.sh: No such file or directory**
Can someone please help me out with what I am missing here? I'm struggling to learn how to do this properly because I can't get my first bit of code up and running. The app/python_code_to_run.py is DEFINITELY located and spelled exactly like that. Same with the sh file.
I've tried a million combinations of things for CMD ["run_py_file.sh"] but I just can't figure this part out. I must be missing magic combination of what to put in the CMD / ENTRYPOINT part of code in order to get this to run. Any help is appreciated!!