Open maciejkamela opened 5 years ago
You have two FROM
statements in your second Dockerfile. This is what is known as a multi-stage build but I think you are doing it by accident. Normally it is used to build something in the first stage and then copy it into the second (smaller) stage. The things you installed in the ubuntu:16.04
part of the build won't be available in the node:9-alpine
part unless you copy them.
However I don't think it would work for what you're doing here. You'd have to copy the unixODBC libraries into the second build stage and it's doubtful if that would work copying libraries built for ubuntu into an alpine image. (I might be wrong but I think this only really works for statically linked binaries)
I came up with this, it may not work but it's a starting point (particularly, it will produce quite a large image because of all the build tools installed). I didn't test if the odbc module itself actually worked, just that the docker build succeeded.
FROM ubuntu:18.04
RUN apt-get update && apt-get install --yes wget gnupg2 apt-transport-https build-essential make
RUN wget -O - https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN wget -O - https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN wget -O - https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql unixodbc-dev nodejs
ADD . /var/www/app
WORKDIR /var/www/app
RUN npm install && npm cache clean --force
RUN npm run build
EXPOSE 3000:80
I had to use wget instead of curl because curl conflicted with packages required by msodbcsql. Also, the issue with sudo
was just that you needed to remove the sudo, the commands are running as root anyway so it isn't needed.
Thank for the answer. I can install the odbc driver and other stuff on Docker but have even though have still some issue with MS ODBC Driver:
{ [Error: [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2' : file not found]
errors:
[ { message:
'[unixODBC][Driver Manager]Can\'t open lib \'/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2\' : file not found',
state: '01000' } ],
error: '[node-odbc] SQL_ERROR',
message:
'[unixODBC][Driver Manager]Can\'t open lib \'/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2\' : file not found',
state: '01000' }
But looks like the driver is installed when I run odbcinst -j
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
Any idea what else might be wrong?
We also tried to use node odbc in docker container. In our case the error is
SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]
I am trying to run my app on the Docker. One of the library I am using is https://www.npmjs.com/package/odbc. In order to install that lib I need to meet the requirements described in the odbc readme:
As per Microsoft doc in order to install ODBC Driver 13 for SQL Server https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017#ubuntu-1604-1 I manage to install all the stuff locally on my Mac and successfully connect with the SQL Server on Azure but still have some issues with installing them on the Docker and then run on VSTS. My Dockerfile:
But so far have an issue with installing NodeJS in line with
error:
/bin/sh: 1: sudo: not found
I was trying to install only the driver and for installing NodeJs just use some existing Docker images:But that approach throws an error: