MySQL container image based on Cognosys/mysql-5-7

Adrian Smith 1 Reputation point
2021-11-14T17:40:05.617+00:00

Within Azure Portal Marketplace I down loaded cognosys/mysql-5-7 container image to my own image repo . I deployed this successfully to a container instance. I am only testing so I deployed this as public and opened port 3306. I was able to connect via work bench from my home PC.
I wanted to deploy this with persistent storage. So via portal I created a storage account and a file share.
I created an export of the container ARM template and saved in my template library. I added the Volumes and Volume Mounts definitions to the ARM template and subsequently credentials to my Image repository and updated the env variables with the SQL credentials. I then deployed the container from portal based on this template and I can see container starting.. and i can see it down loading MySQL files to the mounted volume/file share. but it fails to bring up MySQL.

I get the following error in the MySQL sandbox err file.

2021-11-14T16:59:49.797184Z 0 [Note] Generated uuid: '47611471-456c-11ec-b71a-00155d7a0cae', server_start_time: 66146621163913583, bytes_sent: 94524980800736
2021-11-14T16:59:49.797198Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 47611471-456c-11ec-b71a-00155d7a0cae.
2021-11-14T16:59:49.801276Z 0 [Note] InnoDB: Buffer pool(s) load completed at 211114 16:59:49
2021-11-14T16:59:49.821040Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-11-14T16:59:49.827272Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2021-11-14T16:59:49.827795Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-11-14T16:59:49.828113Z 0 [Note] IPv6 is available.
2021-11-14T16:59:49.828123Z 0 [Note] - '::' resolves to '::';
2021-11-14T16:59:49.828144Z 0 [Note] Server socket created on IP: '::'.
2021-11-14T16:59:49.857805Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-11-14T16:59:49.857918Z 0 [Warning] Failed to open optimizer cost constant tables

2021-11-14T16:59:49.858062Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2021-11-14T16:59:49.858074Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2021-11-14T16:59:49.858121Z 0 [ERROR] Aborting

I m guessing this is an issue related to Linux container attempting to access a file share over SMB and is getting a permission related issue ??? Stress the word guessing.

ARM template definitions

"volumeMounts": [
{
"name": "filesharevolume",
"mountPath": "/var/lib/mysql",
"readOnly": false
}
]

"volumes": [
{
"name": "filesharevolume",
"azureFile": {
"shareName": "sqldatabasefileshare",
"storageAccountName": "yyyyyyyyyyyyyyyyyyy",
"storageAccountKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
]

Any ideas. I ve searched around and can see a recommendation on an openstack thread re accessing Azure file shares from openstack hosted containers and they appear to have additional options available in mounting shares... I dont know if this is my issue or I am randomly going down a wrong path. My main goal is accessing a persistent volume within an Azure Container that mySQL can use... IE the File share is mounting ok. Some files are down loaded to it as part of docker deployment. It fails during mySQL start... but i dont think its a MySQL issue i htink its a container to SMB share issue. I assume some one has got this going ?

mountOptions:

  • dir_mode=0700
  • file_mode=0600
  • uid=<container_process_uid>
  • gid=0
Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,172 questions
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
645 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Adrian Smith 1 Reputation point
    2021-11-15T00:35:13.57+00:00

    I abandoned the cognosys/mysql image and created a new image based on mysql supplied docker image and with same volume definitions the container started fine. So never worked out what was wrong with the previous definitions but I m good to go so happy to close.