This is the docker-compose file
version: '3.3'
services:
mysql:
image: mysql:latest
restart: always
environment:
MYSQL_DATABASE: 'bot'
MYSQL_USER: 'user'
MYSQL_PASSWORD: '123'
MYSQL_ROOT_PASSWORD: 'root'
ports:
- '3306:3306'
expose:
- '3306'
volumes:
- mybot:/var/lib/mysql
python:
restart: always
build: .
environment:
MYSQL_DATABASE: 'bot'
MYSQL_USER: 'user'
MYSQL_PASSWORD: '123'
MYSQL_ROOT_PASSWORD: 'root'
volumes:
- mybot:/usr/app
command: tail -f /dev/null
volumes:
mybot:
and Dockerfile
FROM python
user root
WORKDIR /usr/src
COPY requirements.txt ./
RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip3 install -r requirements.txt
RUN mkdir -p new
COPY . ./new
Now, when I run sh terminal from python container, i had access to mysql database without problem (before that i manually installed default-mysql-server)
mysql -u user -p -u 172.X.X.X
mysql>
and also i am able to ping between containers with no errors, BUT when I run main.py I get the following error
mysql.connector.errors.InterfaceError: 2055: Lost connection to MySQL server at '172.X.X.X:3306', system error: 1 [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1123)
main.py is connecting to mysql like this
self.mydb = mysql.connector.connect(host=params["host"],
user=params["user"],
password=params["pass"],
database=params["database"])
and mysql my.cnf file has this custom lines
port = 3306
bind-address = 172.X.X.X
"outside" docker containers, everything works great.. Thank you!
Package Version ---------------------- ------- mysql-connector-python 8.0.5 pip 20.1.1 protobuf 3.12.2 setuptools 49.2.0 six 1.15.0 wheel 0.34.2
Thanks for your help! tell me if something is needed! – Brazilein