I'm confronted with a strange situation...I'm deve...
# ask-community
j
I'm confronted with a strange situation...I'm developing a pipeline in dagster. First locally (all ran well) and now I want to dockerize the whole repo in different docker images based on the dagster documentation of deploying dagster with multiple docker containers and docker-compose. The problem is all around a connection to a SQL Server. When I don't do anything specific in my Dockerfile_user_code for ODBC driver installations, the whole dagster ecosystem is spinning up well but naturally I receive a pyodbc error that the connection to sql server cannot be made. After searching for a while. I have added the following to the docker file:
# Add SQL Server ODBC Driver 17 for Ubuntu 18.04
RUN curl <https://packages.microsoft.com/keys/microsoft.asc> | apt-key add - \
&& curl <https://packages.microsoft.com/config/debian/10/prod.list> > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends --allow-unauthenticated msodbcsql17 mssql-tools \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
When I spin up the docker stack with above code block in the Dockerfile_user_code I receive an grpc server error: failed to connect to all addresses. Can someone please help me with this issue? What do I need to do to make the connection to SQL Server possible? Thank you in advance!
Next episode: I have created a separate repo based on the deploy_docker example (nothing changed from source code). Thereafter, I changed the Dockerfile_user_code to the following:
FROM python:3.10
ENV ACCEPT_EULA=Y
RUN apt-get update -y && apt-get update \
&& apt-get install -y --no-install-recommends curl gcc g++ gnupg unixodbc-dev unixodbc
# Add SQL Server ODBC Driver 17 for Ubuntu 18.04
RUN curl <https://packages.microsoft.com/keys/microsoft.asc> | apt-key add - \
&& curl <https://packages.microsoft.com/config/debian/10/prod.list> > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends --allow-unauthenticated msodbcsql17 mssql-tools \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
# Checkout and install dagster libraries needed to run the gRPC server
# exposing your repository to dagit and dagster-daemon, and to load the DagsterInstance
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
# Add repository code
WORKDIR /opt/dagster/app
COPY . /opt/dagster/app
# Run dagster gRPC server on port 4000
EXPOSE 4000
# CMD allows this to be overridden from run launchers or executors that want
# to run other commands against your repository
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4000", "-f", "repo.py"]
This image worked well; no errors. Next, I copied this to my original repo and still receive the GRPC error...
It seemed to be an issue at my side. Problem is solved 🙂