15

I am building a docker container for a django application, which uses nginx and uwsgi. For the Database the application is using mysql, which is located in a different container and both of them are link with a docker-compose.yml file:

version: '2'
services:
    mysql:  
        image: mysql:latest
        environment:
            -MYSQL_DATABASE: TheDatabase
            -MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
            -MYSQL_USER: TheUsername
            -MYSQL_PASSWORD: ThePassword

        ports:
            -"3306:3306"

    django:
        build: .
        volumes:
            - .:/app
        ports:
            - "443:443"
            - "8000:8000"
        links:
            - mysql

I am using SSL certificates, which are self-signed using OpenSSL and are included in the nginx.conf file. The problem is that every time I run the containers and try to log as the superuser I get the following error 504 Timed Out. After a decent amount of thinking I came to the conclusion that the issue is in the connection to the mysql database. I did enter the mysql container and saw that the Database is there and after inspecting the tables, I saw that all the tables have been created. However, after reading the logs I noticed the following line:

[Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key.

How am I supposed to add the SSL key and certificate, when I am using a ready image from the docker hub? Is that why I getting the 504 Timed out error? I am also getting the following 3 Warnings:

[Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.

[Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.

[Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode

Community
  • 1
  • 1
dsax7
  • 1,333
  • 22
  • 36

1 Answers1

1

"If you want the server to be able to deploy with automatic support for secure connections, use the mysql_ssl_rsa_setup utility to create default SSL and RSA files:

shell> mysql_ssl_rsa_setup

For more information, see Section 4.4.5, “mysql_ssl_rsa_setup — Create SSL/RSA Files”.

mysql_ssl_rsa_setup

Only the MySQL enterprise edition server will create the certificates for you at --initialize time.

Courtesy-MySQL

Vineeth
  • 692
  • 3
  • 9
  • 18