I have 'sql_helper' that connect to my sql server.
db_connection = 'mssql+pymssql://{user}:{password}@{server}/{db}'.format(
user=db_user, password=db_password, server=server_name, db=db_name)
engine = sa.create_engine(db_connection)
When running it locally it works well.
Then, I have added it to my jupyter kernel docker image. This is the docker file
# start from the jupyter image pre-installed
FROM jupyter/datascience-notebook
# install the docker
RUN pip install docker
# install the pymssql
RUN pip install pymssql
# install the kernel gateway
RUN pip install jupyter_kernel_gateway
# install the configuration helper
COPY configuration_helper-0.0.1-py3-none-any.whl /tmp/configuration_helper-0.0.1-py3-none-any.whl
RUN pip install /tmp/configuration_helper-0.0.1-py3-none-any.whl
# install the sql helper
COPY sql_helper-0.0.1-py3-none-any.whl /tmp/sql_helper-0.0.1-py3-none-any.whl
RUN pip install /tmp/sql_helper-0.0.1-py3-none-any.whl
# update enviroment variable
ENV AM_I_IN_A_DOCKER_CONTAINER Yes
EXPOSE 1433
EXPOSE 5000
# run kernel gateway on container start, not notebook server
EXPOSE 8888
CMD ["jupyter", "kernelgateway", "--KernelGatewayApp.ip=0.0.0.0", "--KernelGatewayApp.port=8888", "--KernelGatewayApp.api=kernel_gateway.notebook_http", "--KernelGatewayApp.seed_uri"]
When running notebook with the following command
docker run -it --rm -p 1433:1433 -e "ACCEPT_EULA=Y" --net=host --name ml_docker_rule_Get_prediction_rule_2 -v C:\Notebooks:/data jupyter-kernel-gateway jupyter kernelgateway --KernelGatewayApp.api='kernel_gateway.notebook_http' --KernelGatewayApp.seed_uri='/data/AOI_app_1.ipynb' --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=8901
I am getting the following error
Unable to connect: Adaptive Server is unavailable or does not exist (TESLADEVSQL01:1433)
Any help how should I run it from docker would be appreciated
Found the problem, instead of using host name need to use sql ip