Could you please help me resolve this issue:
I must to say that everything is working fine on Windows amd64 architecture
But when I tried to start docker-compose on arm64 M1 it went wrong and makes the error
So I have these 2 Dockerfiles
FROM --platform=linux/amd64 python:3.9-buster as builder
WORKDIR ...
COPY ...
RUN apt-get update && apt-get install -y git g++ libgirepository1.0-dev unixodbc unixodbc-dev pkg-config libcairo2-dev gcc python3-dev
RUN pip install virtualenv &&\
python -m venv antenv
RUN . antenv/bin/activate &&\
python -m ensurepip --upgrade &&\
pip install --upgrade pip &&\
pip install wheel gobject PyGObject &&\
pip install -r requirements.txt
FROM --platform=linux/amd64 python:3.9-slim
WORKDIR ...
COPY --from=builder ...
RUN apt-get update && apt-get install curl gnupg -y
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - &&\
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list &&\
apt-get update &&\
ACCEPT_EULA=Y apt-get install msodbcsql17 mssql-tools -y &&\
apt-get install -y unixodbc python3-gi gir1.2-secret-1 alembic &&\
. antenv/bin/activate && pip install gunicorn &&\
mkdir -p /opt/antenv/nltk_data
EXPOSE 5000
CMD . antenv/bin/activate && alembic -x data=true upgrade head && gunicorn wsgi:app -w 1 --worker-class eventlet --threads 2 --forwarded-allow-ips=* -b 0.0.0.0:5000
and DataBase:
FROM --platform=linux/amd64 mcr.microsoft.com/mssql/server:2017-latest
WORKDIR /opt/mssql/
# Bundle config source
COPY ./*.sh /opt/mssql/bin/
RUN chmod +x /opt/mssql/bin/*.sh
ENTRYPOINT ["./bin/entrypoint.sh"]
CMD ["tail -f /dev/null"]
As you can see I mentioned everywhere that it is linux/amd64 platform
DataBase is upping good and I don`t get eerors
But when I up Backend, It as if does not see database and I get timeout error
backend | sqlalchemy.exc.OperationalError: (pyodbc.OperationalError) ('HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
backend | (Background on this error at: https://sqlalche.me/e/14/e3q8)
Related
i have UAT and production setup on same server with identical code only the backend service is exposed on different ports.
i use the docker-compose up --build to start the application
but i am unable to start the uat and production application at same time.
first i go to the uat folder and run docker-compose up --build the application starts and same is visible in docker ps as well
but then i go to prod folder and issue docker-compose up --build it starts the service but the uat service goes down automatically
ideally when the code is in 2 different places it should behave as 2 different application and should be independent but its not happening.
docker-compose.yml
version: "2.2"
services:
webbackend:
build: .
network_mode: "host"
container_name: atms-webapp-backend-test
restart: always
volumes:
- .:/code
command:
"python3.7 app.py --port=5002"
# "gunicorn --workers=2 --bind=0.0.0.0:9000 utootuweb.wsgi:application"
Dockerfile
FROM ubuntu:18.04
WORKDIR /code
ADD . /code
RUN apt-get update && apt-get upgrade -y && apt-get clean
ENV NODE_VERSION=16.16.0
RUN apt-get install -y curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version
WORKDIR /code/frontend
RUN npm install
RUN npm run build
# RUN npm install -g serve
# RUN serve -s build
# RUN yarn
# RUN yarn build
# # Upgrade installed packages
# RUN apt-get update && apt-get upgrade -y && apt-get clean
# # Python package management and basic dependencies
#
# RUN apt-get install -y curl python3.7 python3.7-dev python3.7-distutils curl
# # node install
# RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
# RUN apt-get install -y nodejs
# # npm install
# RUN apt install -y npm
# RUN npm install -g npm#latest
#
# Python package management and basic dependencies
RUN apt-get install -y curl python3.7 python3.7-dev python3.7-distutils
# Register the version in alternatives
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
# Set python 3 as the default python
RUN update-alternatives --set python /usr/bin/python3.7
RUN apt-get install -y build-essential python3.7 python3.7-dev python3-pip python3.7-venv libgl1
RUN apt-get install -y git
# update pip
RUN python3.7 -m pip install pip --upgrade
RUN python3.7 -m pip install wheel
# build frontend
# WORKDIR /code/frontend
#
# RUN npm install
# RUN npm run build
# install backend code
WORKDIR /code
RUN python3.7 -m pip install -r requirements.txt
WORKDIR /code/backend
CMD ["python3" ,"app.py"]
i have the same code base in 2 folders uat and prod
only the port is different
docker --version
Docker version 20.10.10, build b485636
docker-compose --version
docker-compose version 1.29.2, build 5becea4c
I changed the container name in docker-compose.yml to unique name for uat and prod as well just to make sure that container name is not the issue
I am basing myself on this guide: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#ubuntu18
Which gives the commands>
if ! [[ "18.04 20.04 21.04" == *"$(lsb_release -rs)"* ]];
then
echo "Ubuntu $(lsb_release -rs) is not currently supported.";
exit;
fi
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
But I keep getting the following errors
root#ip-172-31-80-13:/home/ubuntu# sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package msodbcsql18
root#ip-172-31-80-13:/home/ubuntu# # optional: for bcp and sqlcmd
root#ip-172-31-80-13:/home/ubuntu# sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mssql-tools18
I have tested on a new instance and I get the same error
I have a requirement to configure shell to install specified version of ODBC.
The app that I'm configuring is an Angular app that uses janusgraph for storing data it is hosted on docker locally.
I updated the odbc.ini file, added the designed version. ref:https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15
I also updated the install-odbc.sh file and added the version details.
ACCEPT_EULA=Y apt-get -y install msodbcsql17=-17.8.so.1.1
# optional: for bcp and sqlcmd
ACCEPT_EULA=Y apt-get -y install mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
apt-get install -y unixodbc-dev
# apt-show-versions msodbcsql17
msodbcsql17:amd64/bionic 17.8.1.1-1 uptodate
Then I deleted the app and installed it again from scratch, everything was successful and my app is backup and running on my local setup on docker.
The only challenge I have is how do I verify that indeed the ODBC version is the one on the odbc.ini file?
ODBC.ini
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.8.so.1.1
Description = MSSQL Server
Trace = Yes
Server = 10.0.0.0
Database = IT_D
Port = 1433
TDS_Version = 7.4
QuotedId = YES
AnsiNPW = YES
Encrypt = YES
TrustServerCertificate = YES
#VarMaxAsLong=YES
[Default]
Driver = /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.8.so.1.1
Docker file:
FROM ubuntu:18.04
# Create app directory
WORKDIR /root/importer
RUN apt-get -y update
# RUN apt-get -y install wget
# RUN wget https://rds-combined-ca-bundle.pem
# Wget not properly resolved by Jenkins, using local file as fallback
COPY ./rds-combined-ca-bundle.pem ./
COPY ./install-odbc.sh ./
RUN apt-get -y install gnupg2
RUN apt-get -y install dos2unix
RUN dos2unix ./install-odbc.sh
# Make sure the microsoft ODBC repository can be added as signed source
RUN apt-get -y update
RUN apt-get install -y curl apt-utils
RUN apt-get install -y apt-transport-https
# RUN apt-key adv --keyserver keyserver.ubuntu.com --keyserver-options http-proxy=${HTTP_PROXY} --recv-keys xxxxxx1229xx
RUN bash ./install-odbc.sh
# Node.js v14
RUN apt-get install -y git-core curl build-essential openssl libssl-dev python
RUN apt-get update -qq && apt-get clean
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get update -qq && apt-get clean
RUN apt-get -y install nodejs
RUN node -v
RUN npm -v
# Oracle installation
ENV ORACLE_INSTANTCLIENT_MAJOR 19.6
ENV ORACLE_INSTANTCLIENT_VERSION 19.6.0.0.0
ENV ORACLE /usr/local/oracle
ENV ORACLE_HOME $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:$ORACLE_HOME/lib
ENV C_INCLUDE_PATH $C_INCLUDE_PATH:$ORACLE/include/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64
RUN apt-get update && apt-get install -y libaio1 \
curl rpm2cpio cpio \
&& mkdir $ORACLE && TMP_DIR="$(mktemp -d)" && cd "$TMP_DIR" \
&& curl -L https://download.oracle.com/otn_software/linux/instantclient/19600/oracle-instantclient${ORACLE_INSTANTCLIENT_MAJOR}-basic-${ORACLE_INSTANTCLIENT_VERSION}-1.x86_64.rpm -o basic.rpm \
&& rpm2cpio basic.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf ./* \
&& ln -s libclntsh.so.${ORACLE_INSTANTCLIENT_MAJOR} $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libclntsh.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& ln -s libocci.so.${ORACLE_INSTANTCLIENT_MAJOR} $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libocci.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& echo "$ORACLE_HOME/lib" > /etc/ld.so.conf.d/oracle.conf && chmod o+r /etc/ld.so.conf.d/oracle.conf && ldconfig \
&& rm -rf /var/lib/apt/lists/* && apt-get purge -y --auto-remove curl rpm2cpio cpio
COPY ./dist/. ./
COPY ./package*.json ./
COPY ./tsconfig.json ./
# RUN npm install node-pre-gyp
RUN npm install
RUN node -v
COPY ./odbc.ini /etc/
RUN dos2unix /etc/odbc.ini
RUN cp /opt/microsoft/msodbcsql17/lib64/* /opt/microsoft/msodbcsql17/lib64/libmsodbcsql
RUN ls /opt/microsoft/msodbcsql17/lib64
COPY ./sqlnet.ora $ORACLE_HOME/network/admin/sqlnet.ora
RUN dos2unix $ORACLE_HOME/network/admin/sqlnet.ora
# CMD bash -c "npm run start:watch"
CMD bash -c "node --max-old-space-size=8192 ./app.js"
I tried to check docker logs but I couldn't file anything that indicates that the ODBC has been updated.
Can you please assist me with the steps to check the ODBC version used by my app.
Thanks in advance
Sivuyile
[01] The application was built and executed in a docker.
The Dockerfile is as follows:
>>>>
FROM ubuntu:xenial
RUN apt-get update -y
RUN apt-get install -y wget
RUN apt-get install -y apt-utils
RUN apt-get install -y python3
RUN apt-get install -y tree
RUN apt-get install build-essential software-properties-common -y
RUN apt-get -y install libgtk2.0-dev
RUN apt-get -y install libgtkglext1-dev
RUN apt-get -y install python3-pip
RUN pip3 install --upgrade pip
RUN apt-get -y install cmake
RUN pip3 install --upgrade cmake
RUN apt-get -y install libnss3-dev
RUN apt-get -y install libxtst6
RUN apt-get -y install libxss1
RUN apt-get -y install libasound2
RUN apt-get -y install libatk-bridge2.0-0
<<<<
the CEF binary being used is
cef_binary_76.1.5+gd8a577c+chromium-76.0.3809.87_linux64/
[02] the application worked fine when starting the docker
with xhost+ and -e DISPLAY=.... as follows:
[A] starting docker with bash
xhost +
docker run \
-it \
--rm \
-e DISPLAY=$DISPLAY
--privileged \
-v /tmp/.X11-unix:/tmp/.X11-unix \
...
--network host \
--name $CONTAINER_NAME \
$REQD_IMAGE \
bash
[B] running the application in bash as
onpaint_streamer \
--no-sandbox \
--disable-gpu \
--disable-gpu-compositing \
--enable-begin-frame-scheduling \
--disable-extensions \
--disable-pdf-extension \
--url=file:///test/027/test.html
[03] the application DID NOT WORK when xhost+ and -e DISPLAY=....
were removed in [02][A]. The following message was dumped
+ ./onpaint_streamer --no-sandbox --disable-gpu --disable-gpu-compositing --enable-begin-frame-scheduling --disable-extensions --disable-pdf-extension --opg-fifo-path=/adhyuh/test/027/onpaint_data_fifo --opg-verbose --url=file:///test/027/test.html
d> CefInitialize : status=about_to
[0812/140301.641476:ERROR:browser_main_loop.cc(1504)] Unable to open X display.
d> CefInitialize : status=done
d> MessageLoop : status=started
[0812/140301.641921:FATAL:context.cc(584)] Check failed: CEF_CURRENTLY_ON(content::BrowserThread::UI).
./run_onpaint_data_writer_in_dk.sh: line 32: 20 Trace/breakpoint trap (core dumped) ./$STREAMER_APP --no-sandbox --disable-gpu --disable-gpu-compositing --enable-begin-frame-scheduling --disable-extensions --disable-pdf-extension --url=file:///test/027/test.html
[04] Some of the other 'flags' embedded in the code are
void SimpleApp::OnContextInitialized() {
//....
CefBrowserSettings browser_settings;
browser_settings.windowless_frame_rate = 30;
CefWindowInfo window_info;
window_info.SetAsWindowless(0);
//....
}
[05] Why should a windowless CEF application require xhost and DISPLAY to be present ? What am i missing or doing wrong ?
CEF depends on X11 library even in windowless mode ... was the answer that i got when a similar post was raised in CEF Forums. Please see https://magpcss.org/ceforum/viewtopic.php?f=6&t=16993&sid=5e46cc6bfb909badf63e0aafcfe9413f&p=42879#p42879
I am trying to create a docker image that has the following:
php7
apache2
git
xdebug
In my dockerfile I have the official php7 with apache image as the base.
I can run apt-get update.
I have installed git successfully.
But when I run apt-get install -y php-xdebug I get the following:
E: Unable to locate package php-debug
Dockerfile:
FROM php:7.0-apache
RUN apt-get update && apt-get install -y git
RUN apt-get install -y php-xdebug